Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. tool.sh <file-to-use>
  2. tool.sh <file-to-use> -o <output-file-name>
  3.  
  4. # If arguments are set and equals "-o" then set APP_NAME
  5. if [[ -n $3 ]] && [[ $2 = "-o" ]]; then
  6. APP_NAME=$3
  7.  
  8. # If argument is set and equals anything besides "-o" throw error and show help menu
  9. elif [[ -n $2 ]] && [[ $2 != "-o" ]]; then
  10. echo "ERROR: Synatx error."
  11. bash $0 -h
  12. exit
  13.  
  14. # If "-o" is set but they did not give a output name throw error and display help menu
  15. elif [[ -z $3 ]] && [[ $2 = "-o" ]]; then
  16. echo "ERROR: Did not specify output file name."
  17. bash $0 -h
  18. exit
  19. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement