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

#!/bin/sh

select num in 1 2 3 any; do
case $num in
1) date;;
2) ls;;
3) who;;
*) echo "Error"; break;;
esac
done

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does $$ mean in shell script?

1110


What is basename in shell script?

1102


What are the various stages of a linux process it passes through?

1248


What is $1 in shell scripting?

1088


How do I run a shell script in powershell?

1177


Determine the output of the following command: [ -z “” ] && echo 0 || echo 1

1031


What is shell variable?

969


What is the purpose of scripting?

1163


How do I open a jshell in cmd?

1319


c program to implement unix/linux command to block the signal ctrl-c and ctrl-\ signal during the execution ls -l|wc -l

3844


What are types of shells?

1074


determine the output of the following command: echo ${new:-variable}

1027


What is the way to do multilevel if-else's in shell scripting?

1351


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?

1223


What is the crontab?

1145