Consider this simple script:
#!/bin/bash
DIR="$1"
for f in "$DIR"; do
if [[ "$f" == "*.txt" ]];
then
echo "Filename is $f"
fi
done
I want to only return files with .txt extension. Calling the script with:
./script1 /home/admin/Documents
Returns nothing. No error, just blank. What is wrong?