Practice: Simple Menu Script
Combine functions, case and arguments.
Example
run() {
case $1 in
start) echo "starting" ;;
stop) echo "stopping" ;;
*) echo "usage: $0 start|stop" ;;
esac
}
run start
run stop
run xResult
starting stopping usage: /tmp/tmphhb2n6lu.sh start|stop
Exercise
Print status.
case $1 in ) echo go ;; esac
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.