Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Create a bash shell script that reads in a number from the
user. If the number is 1, print out the date. If the number
is 2, list the files in the current directory. If the number
is 3, print out who is currently logged onto the system. If
the number is anything else, print out an error message and
exit. Name this script "various.sh"

Answer Posted / kasu

echo "Enter the number"
read i
if [ $i -eq 1 ];then
echo `date`
elif [ $i -eq 2 ];then
ls
elif [ $i -eq 3 ];then
who
else
echo "Nothing"
fi

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is scripting used for?

994


What is shell environment?

917


How will you emulate wc –l using awk?

1466


What is a shell script? Can you name some of its advantages?

973


What is the first line in a shell script?

1026


Is cmd a shell?

960


write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?

4050


What is a command line shell?

995


Explain about debugging?

966


Write the syntax for "if" conditionals in linux?

1052


How to print pid of the current shell?

946


How important is shell scripting?

985


how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?

4020


How will you print the login names of all users on a system?

919


What is difference between bash and shell?

1011