From d6d74706835d4a8220bda063c9af70793bfe268c Mon Sep 17 00:00:00 2001 From: Jan Vitturi Date: Fri, 20 Sep 2019 15:36:14 +0200 Subject: [PATCH] Add caveats for unexpanded globs --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 42ba1f3..263ff18 100644 --- a/README.md +++ b/README.md @@ -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. +**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:** ```sh @@ -575,6 +577,8 @@ done < "file" Don’t use `ls`. +**CAVEAT:** When the glob does not match anything (empty directory or no matching files) the variable will contain the unexpanded glob. + ```shell # Greedy example. for file in *; do