Guest User

Untitled

a guest
Sep 18th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. # by Kris
  2. if [[ $# -gt 0 ]]; then
  3. for ele in `echo "$@"`; do
  4. IFS='='
  5. opt=(${ele})
  6. # +option, sign, value
  7. if [[ "${opt[0]:0:1}" == "+" ]]; then
  8. eval ${opt[0]:1}="${ele}"
  9. eval ${opt[0]:1}S="+"
  10. if [[ "${opt[1]}" == "" ]]; then
  11. eval ${opt[0]:1}V=""
  12. else
  13. eval ${opt[0]:1}V="${opt[1]}"
  14. fi
  15. # -option, sign, value
  16. elif [[ "${opt[0]:0:1}" == "-" ]]; then
  17. eval ${opt[0]:1}="${ele}"
  18. eval ${opt[0]:1}S="-"
  19. if [[ "${opt[1]}" == "" ]]; then
  20. eval ${opt[0]:1}V=""
  21. else
  22. eval ${opt[0]:1}V="${opt[1]}"
  23. fi
  24. fi
  25. done
  26. unset IFS
  27. fi
Add Comment
Please, Sign In to add comment