Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Shell script to read an IP address from user's input and check if the input IP address is valid or not. Fill in the Blank

Shell script to read an IP address from user's input and check if the input IP address is valid or not.

Fill in the Blank to complete the task!

#!/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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

=+Could you create an interactive game on the website?

Answered: 1 week ago