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 are the different commands available to check the disk usage?
Why is shell scripting important?
determine the output of the following command: echo ${new:-variable}
What are the types of script?
What are the advantages of shell scripting?
Why do we use shell scripting?
What is bourne shell scripting?
Explore about environment variables?
What can you do with powershell?
How will you pass and access arguments to a script in linux?
Explain about shebang?
Is shell a scripting language?
What is shell variable?
What is a command line shell?
What are the default permissions of a file when it is created?