SyntaxFix
Write A Post
Hire A Developer
Questions
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.
==
=~