0

I'm trying to refresh my bash scripting skills. I got stuck on the dumbest thing:

for f in "$(ls)"; do
    [[ $f == *.txt ]] && printf "%s\n" "$f"
done

What is wrong with this loop? I'm simply trying to print all the .txt files in the current dir. It seems that pattern match is wrong..

alfredopacino
  • 183
  • 1
  • 7

0 Answers0