Guest User

Untitled

a guest
Nov 15th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #set "default" parameter
  2. query=""
  3.  
  4. while [ "$1" != "" ]; do
  5. case $1 in
  6. -q | --query ) shift
  7. query=$1
  8. ;;
  9. esac
  10. shift
  11. done
  12.  
  13. #query cannot be empty
  14. if (($query == ""))
  15. then
  16. echo 'no query'
  17. exit
  18. fi
  19.  
  20. echo "query - $query"
  21.  
  22. ./script.sh -q request
  23.  
  24. query - request
  25.  
  26. ./script.sh -q
  27.  
  28. ./script.sh
  29.  
  30. ./main.sh: line 13: ((: == : syntax error: operand expected (error token is "== ")
  31.  
  32. query -
  33.  
  34. if [ "$query" == "" ]
  35.  
  36. if [ -z "$query" ]
Add Comment
Please, Sign In to add comment