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 / aryan
cho "Enter Choice"
read num
case $num in
1) echo `date`
;;
2) ls
;;
3) who
;;
*) echo "Wrong option press 1 2 3 only"
;;
esac
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
How to write a function?
Where are cowrie shells found?
how to print the 2-d, 3-d arrays in unix shell script programs please answer thi questio to my mail venusaikumar@gmail.com
What is the use of "$?" Sign in shell script?
What is the command to find out today's date?
Explain about stdin, stdout and stderr?
What are the different variables present in linux shell?
How do I edit a .sh file?
What is the use of a shebang line?
How do I run a .sh file on mac?
What is gui scripting?
Is shell scripting difficult?
What is a shell environment?
What is the best scripting language?
What is shell scripting?