September 2018
Beginner
186 pages
4h 30m
English
You may also have noticed with some experimentation with globs that if the pattern does not match anything, it expands to itself, unchanged:
$ printf '%s\n' c* c*
Because none of our test files start with c, the glob is unexpanded and unchanged. This may seem strange; surely it would be better if the pattern expanded to nothing at all? It makes more sense when you consider the behavior of many classic Unix commands; if there are no arguments, they default to assuming input is coming from standard input. For example:
$ cat -- c* cat: 'c*': No such file or directory
Because the pattern here did not expand, cat saw the c* argument, found the file named c* did not exist, and reported that to us, with an error message that ...
Read now
Unlock full access