Add caveats for unexpanded globs

This commit is contained in:
Jan Vitturi 2019-09-20 15:36:14 +02:00 committed by GitHub
parent 4011d6482b
commit d6d7470683
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -439,6 +439,8 @@ $ lines ~/.bashrc
This works by passing the output of the glob to the function and then counting the number of arguments. This works by passing the output of the glob to the function and then counting the number of arguments.
**CAVEAT:** When the glob does not match anything (empty directory or no matching files) it is not expanded and the function returns `1`.
**Example Function:** **Example Function:**
```sh ```sh
@ -575,6 +577,8 @@ done < "file"
Dont use `ls`. Dont use `ls`.
**CAVEAT:** When the glob does not match anything (empty directory or no matching files) the variable will contain the unexpanded glob.
```shell ```shell
# Greedy example. # Greedy example.
for file in *; do for file in *; do