I'm trying to create a variable with a list of files in it so that I can iterate through them. I'm doing so like this:
FILES=(`ls *.jpg`)
FILES="${FILES[@]}"
When I run this script, it simply throws:
ls: cannot access *.jpg: No such file or directory
I've looked at some other answers for issues similar to this, and I'm fairly sure this isn't a permissions issue, as adding sudo
to the front doesn't have any effect and I am root
. I've also checked the permissions on the script itself and they are -rwxr-xr-x
, so I think I'm good there.
Any idea how I can fix this?