I am relatively new to bash scripting, and I have the following script, which is not giving me results I expect. So, my script looks like so:
#!/bin/bash
echo "Today is $(date)"
shopt -s nullglob
FILES=/some/empty/dir/with/no/text/files/*.txt
#echo $FILES
if [ -z "$FILES" ]
then
echo 'FILES variable is empty'
exit
else
echo 'FILES variable is not empty'
echo 'done' > write_file_out.dat
fi
So, the directory I am trying to use FILES on is completely empty - and still, when I do if [ -z "$FILES" ] it seems to say that it is not empty.
Baffled by this - wondering if someone can point me in the right direction.