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

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!