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
What is option in shell script?
Is bash an operating system?
How can we find the process name from its process id?
Is scripting and coding the same thing?
What does $1 mean in bash?
What is the default shell of solaris?
How can you find out how long the system has been running?
Print the 10th line without using tail and head command.
How do I run a shell script on a mac?
Is powershell a language?
How can I set the default rwx permission to all users on every file which is created in the current shell?
How to debug the problems encountered in the shell script/program?
What are the four fundamental components of every file system on linux?
What are the different types of shell scripting?
What is the significance of the shebang line in shell scripting?