forked from koalaman/shellcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
SC2144
Vidar Holen edited this page Oct 4, 2015
·
3 revisions
if [ -e dir/*.mp3 ]
then
echo "There are mp3 files."
fi
for file in dir/*.mp3
do
if [ -e "$file" ]
then
echo "There are mp3 files"
break
fi
done
[ -e file* ]
only works if there's 0 or 1 matches. If there are multiple, it becomes [ -e file1 file2 ]
, and the test fails.
[[ -e file* ]]
doesn't work at all.
Instead, use a for loop to expand the glob and check each result individually.
None.