Scenario: I have a set of .txt files inside folder and script is checking whether *.txt files exists or not
Script:
set -x
if [ -f *.txt ]
then
echo exist
else
echo not
fi
Output:
+ '[' -f 1.txt 2.txt ']'
test.sh: line 2: [: 1.txt: binary operator expected
+ echo not
not
Aucun commentaire:
Enregistrer un commentaire