Hello
I've encountered some difficulty while writing my own bash
program, the situation is: I want to know wheather a directory is Empty
or not, if it is, it will echo a message i.e. " Directory Empty ", and
if it's not, it will ls th files. I wonde how it could be achieved?
Below I tried putting the ls result into a TEMPVAR, and check if its
NULL, however it didn't work. I wonder where i did wrong or is that way
possible? Any help would be greatly appreciated. Thank you !
# $RECY=a directory
TEMPVAR=`ls $RECY`
if TEMPVAR=NULL
then
echo "There are currently no files in the directory"
else
ls $RECY
fi
Thank you very much,
Leo