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 clear echo
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 = A. if [B. 0]; then # replace each dot by a space in string ip ip = C. isValid=0 # loop over the words in string ip for n in D.;do if [E. -o $n -1t 0]; then echo "ERROR: The number of the IP should not be greater than 255 and less than 0" F. break; fi done if [G.]; then echo" This is a valid IP " fi else echo " ERROR: The IP format you input 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