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 happens on a system call?
how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?
What is the significance of the shebang line in shell scripting?
How would you compare the strings in a shell script?
Where is bash history?
Where are cowrie shells found?
What exactly is a shell?
What is k shell?
What is the difference between bash and shell?
What are the four fundamental components of every file system on linux?
Explain about debugging?
What is ms powershell?
What is the crontab?
What does $1 mean in bash?
How to print the first array element?