The following Bourne shell script and C program can accomplishthe same task:
read an IP address from user’s input and check if the input IPaddress is valid or not.
Fill in the Blanks!
Shell script
#!/bin/bash
echo -n “Please enter the ip:”
_______A._______
echo $ip|grep _______B.______________
if [_______C._______]
then
echo “Please enter IP address following the
IP address pattern”
exit
fi
C programm
#include<stdio.h>
int main(){
int ip1=0,ip2=0,ip3=0,ip4=0;
int n=0;
n=scanf(“_______A2._________”,
_______B2.__________);
if (n!=4) {
printf(“Please enter IP address
following the IP address pattern”);
Expert Answer
An answer will be send to you shortly. . . . .