Make
if [ "$file" == "*.txt" ]
like this:
if [[ $file == *.txt ]]
That is, double brackets and no quotes.
The right side of ==
is a shell pattern.
If you need a regular expression, use =~
then.
Make
if [ "$file" == "*.txt" ]
like this:
if [[ $file == *.txt ]]
That is, double brackets and no quotes.
The right side of ==
is a shell pattern.
If you need a regular expression, use =~
then.