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 are the advantages of shell scripting?
What is the lifespan of a variable inside a shell script?
Print the 10th line without using tail and head command.
What is shell company all about?
Is cmd a shell?
Write a command sequence to find all the files modified in less than 2 days and print the record count of each.
How does shell scripting work?
What is the equivalent of a file shortcut that we have a window on a linux system?
What is web script?
Explain about non-login shell files?
How can I set the default rwx permission to all users on every file which is created in the current shell?
How do you create a shortcut in linux?
What does it mean by #!/Bin/sh or #!/Bin/bash at the beginning of every script?
What is shell variable?
i have 2 tables 4 colums table 1 respective values a1 6, a2 8,a3 9,a4 14 & table 2 respective values a1 6, a2 8, a3 9, a4 12. if compare 2 tables 3 colums values same then 4th column values 1)Qes diff >5 then (5 * diff value ) 2)Qes diff <5 the 5 3)Qes diff 5 then 5 print respective values..