linux - Bash If statement with user input -
i trying create bash script prompt user input asking vpn tunnel user connect to. so, example.. there pvn1 , vpn2 needs like: understand in it's current state pseudo code..
read -p "connect vpn1 or vpn2? (enter vpn1 or vpn2)" if vpn1 /path/to/vpn/cert if vpn2 /path/to/vpn/cert
i appreciate guidence thing can find online "yes/no" input responses.. these [if "yes" "this" .. if "no or other" "nothing or exit"...
this example simple need done. need exact bash command ran "vpn1" , exact bash command "vpn2"
i appreciate :)
you need give variable read
command, , compare it.
read -p "connect vpn1 or vpn2? (enter vpn1 or vpn2)" vpn case "$vpn" in vpn1) stuff ;; vpn2) other stuff ;; *) echo "enter vpn1 or vpn2" ;; esac
replace do stuff
, do other stuff
actual commands want run in each case.
Comments
Post a Comment