Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

Bash script to use getopts to get multiple values from user

while getopts :a:b:c: options; do
        case $options in

         a) fival=$OPTARG ;;
         b) secval=$OPTARG ;;
         c) thival=$OPTARG ;;
         ?) echo "i dont know what $OPTARG is" ;;
esac
done

echo "A = $firval"
echo "B = $secval"
echo "C = $thival"
 
PREVIOUS NEXT
Tagged: #Bash #script #getopts #multiple #values #user
ADD COMMENT
Topic
Name
6+8 =