Course Solutions Uncategorized (Solved) : Following Bourne Shell Script C Program Accomplish Task Read Ip Address User S Input Check Q27957114 . . . .

(Solved) : Following Bourne Shell Script C Program Accomplish Task Read Ip Address User S Input Check Q27957114 . . . .

 

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

#replace the dots in ip with spaces
ip=`echo $ip | sed _______D._______
valid=1
n=1
for num in $ip
do
if [ _______E._______ ]
then
echo “INVALID: Please enter a number
between 0-255 in field $n (index starts
from 1 from left)”
valid=0
exit
fi
n=`expr $n + 1`
done
if [ $valid -eq 1 ];then
echo “The ip you entered is valid”
fi

C program

#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

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post