Question: Write a Python program that pings google.com only once every time an external switch is pressed. Note that after completing this exercise you should be
Write a Python program that pings google.com only once every time an external switch is pressed. Note that after completing this exercise you should be able to execute any Linux command using an external switch. It is also possible to write a Shell script to accept an argument. Run this example and see what it does?
#!/bin/bash
echo -n "Is this a good question (y/n)? "
read answer
if echo "$answer" | grep -iq "^y" ;then
echo Yes
else
echo No
fi
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
