Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #!/bin/sh
  2. dflag=
  3. vflag=
  4. cflag=
  5.  
  6. if [ $# -lt 1 ]
  7. then
  8. wget -qO - http://yoursite.com/tvguide.xml
  9. exit 0
  10. fi
  11.  
  12. for arg
  13. do
  14. delim=""
  15. case "$arg" in
  16. #translate --gnu-long-options to -g (short options)
  17. --description) args="${args}-d ";;
  18. --version) args="${args}-v ";;
  19. --capabilities) args="${args}-c ";;
  20. #pass through anything else
  21. *) [[ "${arg:0:1}" == "-" ]] || delim="\""
  22. args="${args}${delim}${arg}${delim} ";;
  23. esac
  24. done
  25.  
  26. #Reset the positional parameters to the short options
  27. eval set -- $args
  28.  
  29. while getopts "dvc" option
  30. do
  31. case $option in
  32. d) dflag=1;;
  33. v) vflag=1;;
  34. c) cflag=1;;
  35. \?) printf "unknown option: -%s\n" $OPTARG
  36. printf "Usage: %s: [--description] [--version] [--capabilities] \n" $(basename $0)
  37. exit 2
  38. ;;
  39. esac >&2
  40. done
  41.  
  42. if [ "$dflag" ]
  43. then
  44. printf "Your Language"
  45. fi
  46. if [ "$vflag" ]
  47. then
  48. printf "0.1\n"
  49. fi
  50. if [ "$cflag" ]
  51. then
  52. printf "baseline\n"
  53. fi
  54.  
  55. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement