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 / avlsubbarao
#!/bin/bash
echo "Enter Number"
read N
if [ $N == 1 ]; then
date
elif [ $N == 2 ]; then
ls
elif [ $N == 3 ]; then
who
else
echo WRONG NUMBER
fi
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What happens when you type ls?
What is a scripting language simple definition?
What is path in shell script?
What is sh in shell script?
How do we create command aliases in a shell?
What are the advantages of shell script?
What is @echo off?
What is awk in shell scripting?
What are the four fundamental components of every file system on linux?
Is shell and terminal the same?
How do I debug a shell script?
Please give me example of " at command , contrab command " how to use
What is the first line in every perl script called?
What are the different types of shell scripting?
What is the use of break command?