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
Write a script to print the first 10 elements of fibonacci series.
Can we run shell script in windows?
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?
What are the advantages of shell script?
Explain about debugging?
What are the zombie processes?
What are the different communication commands available in the shell?
how to get part of string variable with echo command only?
Is shell scripting easy to learn?
madhar chod unix ke 10 commands dhang se likh nahi sakta hai
Please give me example of " at command , contrab command " how to use
What is $1 in shell scripting?
What is the difference between break and continue commands?
What is a scripting language simple definition?
How do I run a .sh file on mac?