I'm very new to Bash scripting (about 2 days), but not completely new to programming. I've devised a zip script through research here and other sites, and am looking for ways to improve it. Here are ways I think it could be improved, but am not sure where to start, or in some cases (#8 and #9) do not know how to do at all.
1. ensure script ran successfully (i.e. all files were unzipped)
2. output errors to a log
3. if error log is created OR has new entries added to it, mail to administrator
4. ensure script ran successfully (i.e. all files were unzipped)
5. look for files not just ending in zip, but also beginning with 'IF' (case insensitive)
6. If $size 0, mail warning that no image files were available for unzipping to administrator
7. make paths more dynamic for easy porting to different webservers (i.e. localhost vs. remote)
8. how to call this script from a PHP file; ie. if bashscript == true, go on to next item.
9. making this more dynamic, based on parameters I set in a PHP script
FILENAME=($(find . -name "*.zip" -type f|tr -d "%.zip" |tr -d "##*/"))
if [ $SIZE > 0 ]; # needs to be at least 1 .zip file in directory
for ((index=0; index<SIZE; index++))
unzip -P password $T.zip -d '../rw-pw/images/listings/'$T