1. 程式人生 > >SHELL菜單select練習

SHELL菜單select練習

bre pro ase doc cti bsp bin ber you

#!/bin/bash echo "please choose your profession?" PS3="please choose the number : " function a(){ echo "this is funciton a" } function b(){ echo "this is function b" } n=0 select var in "worker" "dock" "teacher" do case $var in worker) a ;; dock) b ;; *) esac echo "the choose num is \$REPLY is $REPLY" echo "your preofession is $var" let n++ if [ $n -gt 2 ] then break fi done


SHELL菜單select練習