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


Please Help Members By Posting Answers For Below Questions

What is a file basename?

598


What is a shell script in windows?

590


Write a shell script to get current date, time, user name and current working directory.

642


What is c in shell script?

642


What is meant by dos operating system?

578






What is bash eval?

552


I want to connect to a remote server and execute some commands, how can I achieve this?

578


How do we delete all blank lines in a file?

579


What is the fastest scripting language?

554


What is sudo command?

555


How do I set bash as default shell mac?

559


How do you know which shell I am using?

593


What is bash shell command?

562


Why do we use shell scripting?

554


What is a scripting language simple definition?

565