Is there an equivelant to goto in bash? Below is a small part of a script I'm working on and depending on the user input I want to skip to the next piece of code.
#!/bin/bash
WAN1_prompt
read -p "WAN1 exists?: " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
Skip to WAN1
else
Skip to WAN2_prompt
fi
WAN1
read -p "Enter WAN1 IP: " wan1
if [[ $wan1 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
sed -i~ -e "s/bizip/$wan1/g" test.txt
else
echo Error
fi
WAN2_prompt
read -p "WAN2 exists?: " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
Skip to WAN2
else
exit
fi
read -p "Enter WAN2 IP: " wan2
if [[ $wan2 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
sed -i~ -e "s/bizip/$wan2/g" test.txt
else
echo Error
fi