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
Explain about debugging?
What is shell geeksforgeeks?
What is a shell script in windows?
wats the deinitions for shell utility and filter?
What are filters explain sort with all the options available?
Why are shell scripts used?
What is another name for a bash shell script that you might see?
What is a boot block?
How to check if the previous command was run successfully?
I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?
How do you create a shortcut in linux?
What is option in shell script?
Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.
What's the difference between scripting and coding?
What is sudo command?