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
What is the crontab?
What exactly is a shell?
What are the different types of variables used in shell script?
Is shell scripting easy to learn?
Write down the syntax for all the loops in shell scripting.
How do I run a .sh file?
What is shell company all about?
What is .sh file in mac?
What language is shell scripting?
How do I run a shell script in powershell?
What is mac default shell?
What are the four fundamental components of every file system on linux?
Write down the syntax of "for " loop
Why is shell scripting important?
What is the use of echo in shell script?