deibel
asked on
Bash Syntax Check
Hi experts,
I'm working with a bash script which is for the ip-configuration.
So the user can type in his ip and subnetmask and broadcast and networkadress and his Defaultgateway like:
echo "Type in your ip:"
read IP
echo "Type in your Subnetmask:"
read Subnetmask
echo "Type in your Broadcast:"
read Broadcast
echo "Type in your Networkadress:"
read Network
echo "Type in your Defaultgateway:"
read Gateway
So yet i Need a kind of Syntax check or something else so that the defaultgateway is only validate when the Input is
between the Network and the broadcast like this:
Network < Gateway < Broadcast
I'm working with a bash script which is for the ip-configuration.
So the user can type in his ip and subnetmask and broadcast and networkadress and his Defaultgateway like:
echo "Type in your ip:"
read IP
echo "Type in your Subnetmask:"
read Subnetmask
echo "Type in your Broadcast:"
read Broadcast
echo "Type in your Networkadress:"
read Network
echo "Type in your Defaultgateway:"
read Gateway
So yet i Need a kind of Syntax check or something else so that the defaultgateway is only validate when the Input is
between the Network and the broadcast like this:
Network < Gateway < Broadcast
[ $Network -lt $Gateway ] && [ $Gateway -lt $Broadcast ] && echo valid
ASKER
Ozo Thank you for your help.
I got a Little question how can i use it in a whileloop or in a if else so that the Programm only accept the right Input? So when the Input is worng that the Programm goes to :echo "Type in your Defaultgateway:"
read Gateway
I got a Little question how can i use it in a whileloop or in a if else so that the Programm only accept the right Input? So when the Input is worng that the Programm goes to :echo "Type in your Defaultgateway:"
read Gateway
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ty for your help.