Guest User

Untitled

a guest
Jul 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. function foo {
  2. PARAM1=$1
  3. PARAM2="$2"
  4. VAR=$3
  5. if[[ -z "$VAR" ]]; then
  6. # code here
  7. else
  8. # other code here
  9. fi
  10. }
  11.  
  12. foo "x" "y" "blah"
  13. foo "x" "y" "true"
  14. foo "y" "y" "1"
  15.  
  16. if [ ! -z "true" ]; then printf 'not emptyn'; fi
  17. not empty
  18.  
  19. if [ ! -z "false" ]; then printf 'not emptyn'; fi
  20. not empty
  21.  
  22. if "false"; then printf 'not emptyn'; fi
  23. # <-- empty result
  24.  
  25. if ! "false"; then printf 'not falsen'; fi
  26. not false
  27.  
  28. if "true"; then printf 'not falsen'; fi
  29. not false
Add Comment
Please, Sign In to add comment