First page Back Continue Last page Overview Graphics
Control Structures, con't
case/;;/esac -- demonstrated in "apt-yum" script :
- case "$1" in
- install)
- shift
- yum install "$@"
- ;;
- update)
- shift
- yum list >/dev/null
- yum clean oldheaders
- ;;
- upgrade)
- shift
- yum update "$@"
- ;;
- dist-upgrade)
- shift
- yum upgrade
- ;;
- *)
- echo "I don't know how to yummify that!"
- exit 1
- ;;
- esac
Note use of positional paremeters $1, $2, etc, shift, $@ for entire line
See getopt(1) for argument parsing "library"
Notes: