Issue
I am trying to write a simple loop that will loop through the files the current directory and just print the file names.
I tried that:
#!/bin/bash
FILES=/Users/nick/Desktop/*.jpg
for f in $FILES
do
echo $f
done
but it didn't work. Running ./script it just printed "/Users/nick/Desktop/*.jpg". No errors
I am running this on a MacBook Pro 10.10.4
Thanks
Solution
for f in /Users/nick/Desktop/*.jpg; do echo $f; done
Edit Actually, I think that this comment of @KyleBurton is very clever and should be taken into account since it explains why a result like OP's could be observed.
Answered By - Leonid Usov Answer Checked By - Dawn Plyler (WPSolving Volunteer)