apache / apache/nuttx-apps

REGEX wildcards in NSH

Open
#2,311 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
465
Forks
779
Avg merge
2d 9h
Merged PRs (30d)
36

Description

All NSH commands that accept a path name differ from the corresponding commands in other shells such as Bash in at least one important way:

* Shells like Bash accept a REGEX pattern matching string. For example, `rm dat*[0-9][.]log` would delete all .log files in the current directory with names like dat_NNN_, where _NNN_ is some decimal number. Another example,` rm *` would delete all non-hidden files in the current working directory (not strictly REGEX).

* In NSH, the argument is the path to a file or directory.

This means the commands like `rm *` fail because `*` is not expanded into a list of file/directory names.

NSH has much of the look and feel these larger shells so any behavioral difference can be confusing. And sometimes there there is no simple alternative to the Bash-like command. There has been discussion recently, for example, on how to do `rm *` without `*`.

A solution would affect all NSH commands with path arguments. That would have to be reinterpreted as a REGEX match pattern and every file in the directory path would have to compared against the pattern and added to a list of paths to be operated on.

NOTE that arguments like `*`, `.`, and `..` are not REGEX and might have to be handled in a different way.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.