All, I have an app where user picks up a zipped folder which a shell script unzips and then renames for processing. The zipped folder will always have the following naming convention: "rXXXXX_CityName.info.zip". The folder inside the zip file is named as "CityName.info" When the shell script unzips the zip file, it will append the "rXXXXX_" to the folder name to create a folder called "rXXXXX_CityName.info". Before unzipping ,the shell script checks if a folder called "rXXXXX_CityName.info" exists, and deletes it if it does. Here is the code:
THEZIPFILE="r12345_Boston.info.zip" DIR="r12345_Boston.info" if [ -d "$DIR" ]; then rm -rf "$DIR" sleep 1 fi if [ ! -d "$DIR" ]; then unzip -o "$THEZIPFILE" > /dev/null & zpid=$! wait $zpid EXIT_STATUS=$? if [ $EXIT_STATUS -eq 0 ]; then rm -rf __MACOSX # Do Some processing.... fi echo $EXIT_STATUS exit else echo "-1" exit fi
I want to know if this code leaves any room for mistakes? Am I right in assuming that the above code will execute sequentially(i.e wait for every command's completion before moving on to the next one)?