Question: 5 . Now we will write a shell script to display IP address of a specified interface. You know ifconfig command. Run it and check

5. Now we will write a shell script to display IP address of a specified interface. You know ifconfig command. Run it and check the results.
6. What if you'd like to see only IP addresses? You can modify your command as
ifconfig | grep 'inet '
grep is a command-line utility for searching plain-text data sets for lines matching a regular expression. This line means run ifconfig and return only line that starts with inet addr
7. You can add interface name to ifconfig as
ifconfig eth0| grep 'inet '
8. Now we will create a script that display IP address of a specified interface. Create new file lIPscript.
echo "Choose interface (eth0, wlan0, lo)"
read -e INTERFACE
echo "You chose $INTERFACE"
The first line will display input prompt, the second one accepts your input, then your input is displayed.
9. Run your code and provide eth0 as input. If you see You chose eth0, then you are ready for the next step. Provide a screenshot of your code run. [1 point]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!