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 / avlsubbarao

#!/bin/bash
echo "Enter Number"
read N
if [ $N == 1 ]; then
date
elif [ $N == 2 ]; then
ls
elif [ $N == 3 ]; then
who
else
echo WRONG NUMBER
fi

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What language is shell scripting?

1009


What is the use of .sh file?

1100


What is in a script?

1001


What is scripting autism?

1199


What is shell prompt?

1005


What is echo $shell?

1061


What is batch file programming?

1146


In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?

1125


What is the purpose of scripting?

1059


Is shell a part of kernel?

1039


What are the zombie processes?

955


What is the lifespan of a variable inside a shell script?

1636


What is the meaning of $1 in shell script?

1105


What is c in shell script?

1053


madhar chod unix ke 10 commands dhang se likh nahi sakta hai

3462