Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following shell script is used to check if the input IP address is invalid or not. Rs = 1 while [$rs -gt 0]; do
The following shell script is used to check if the input IP address is invalid or not. Rs = 1 while [$rs -gt 0]; do clear echo -n Please input the ip read ip #use expr to check if the input IP address follows the IP address pattern is IP = if; then replace each dot by a space in string ip ip = isvalid = 0; #loop over the words in string ip for n in; do if [-0 $n -1t 0]; then echo "ERROR: The number of the IP should not be greater less than 255 and less than 0" break; done if; then echo'----- This is a valid IP-'. Fi else echo "ERROR: The IP format you in is wrong, the format should be like 192.168.100.1 fi echo echo -n Press 0 to exit and other numbers to continue....." read rs done
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started