executable (945B)
1 #!/usr/bin/env bash 2 # CREATED BY ALEX BALGAVY OF INSIGHTDEV 3 # COPYRIGHT (C)2013 ALEX BALGAVY 4 # FREE TO USE OR SHARE 5 6 # Sets the parameters equal to variables 7 FILENAME="${1}" 8 9 # Sets the exit error 10 NO_FILE="Exit error 85: No file found." 11 12 # Starts the parameter case 13 # Checks if $FILENAME exists 14 if [ ! -e "$FILENAME" ]; then 15 echo "There is no file called $FILENAME" 16 echo "Please check spelling" 17 exit 18 else 19 echo "Congratulations found $FILENAME. " 20 21 # Does some stuff to make it look cool 22 ls -lah $FILENAME 23 read -p "Process $FILENAME? Y or N:" PROCEED 24 case $PROCEED in 25 Y* | y*) 26 chmod +x $FILENAME 27 echo "Successfully changed to executable." 28 read -p "Do you want to run $FILENAME? Y or N:" RUN_OR_NOT 29 case $RUN_OR_NOT in 30 Y* | y*) 31 ./$FILENAME 32 ;; 33 *) 34 echo "File not run. You can manually run by doing ./$FILENAME" 35 ;; 36 *) 37 echo "File not processed." 38 ;; 39 esac 40 esac 41 fi