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 is difference between shell and bash scripting?

937


wats the deinitions for shell utility and filter?

2251


When should shell programming/scripting not be used?

1078


write a shell script to emulate the Id command of PRIMOS which lists files and directories. It list files first with a header FILES and then directories with a header DIRECTORIES. This command has several options. The main ones are. -file select files only -dir select directories only -reverse sort in reverse order -no_header put no header on the output -brief output the header only -size display the size of each file -help display Id´s syntax and options.

2705


How do I run a .sh file on mac?

1084


How do I run a shell script in powershell?

1065


How do I open the shell in cmd?

1047


What are different types of shell?

877


How do I open a jshell in cmd?

1144


Determine the output of the following command: name=shubham && echo ‘my name is $name’.

930


How do I set bash as default shell mac?

944


What is the use of .sh file?

1052


How do you know which shell I am using?

984


How to pass an argument to a script?

1092


Where is bash history?

857