Hi all.
I am wiritng a bash script to generate a web-based photo album/gallery.
I have the option of generating basic html file or php files with some enhanced features.
Prior to updating the gallery I want to delete a the previous exisiting html or php files.
Here's how I am trying to do it now:
Code:
####################################
#
# Remove Old Pages
#
OLDPAGES="$(ls $DIRPATH*.[PpHh][HhTt][PpMm][Ll])"
for PAGES in $OLDPAGES
do
echo "Removing: $PAGES"
rm -f $PAGES
done
That works fine for html files exist in the directory. If if only php files exist in the directory I get:
Code:
ls: /home/cfarley/webdata/wolverine/wip2/*.[PpHh][HhTt][PpMm][Ll]: No such file or directory
I know it's the final [Ll] causing it to fail. I know there are some wildcards that can be placed on the arguments to make them option but can't quite get it to work.
Anyone have and idea how to make the '[Ll]' optional?