Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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"

Answers were Sorted based on User's Feedback



Create a bash shell script that reads in a number from the user. If the number is 1, print out the ..

Answer / 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

Create a bash shell script that reads in a number from the user. If the number is 1, print out the ..

Answer / kasu

echo "Enter the number"
read i
if [ $i -eq 1 ];then
echo `date`
elif [ $i -eq 2 ];then
ls
elif [ $i -eq 3 ];then
who
else
echo "Nothing"
fi

Is This Answer Correct ?    4 Yes 1 No

Create a bash shell script that reads in a number from the user. If the number is 1, print out the ..

Answer / 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

Create a bash shell script that reads in a number from the user. If the number is 1, print out the ..

Answer / 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

More Shell Script Interview Questions

What is gui scripting?

0 Answers  


How to enable the shell to know what program should be run to interpret the script?

3 Answers  


what is "umask"?

6 Answers   Wipro,


What are the types of script?

0 Answers  


What does chmod do?

0 Answers  


What are the different shells available?

3 Answers  


c program which behaves like a shell(command interpreter). it has its own prompt say "NewShell$".any normal shell command is executed from your shell by starting a child process to execute a system program corrosponding to the command

0 Answers  


What are the different commands available to check the disk usage?

0 Answers  


What are the three main forms of enabling debugging in a shell script?

6 Answers   ADC, Wipro,


write a shell script to check whether all the directories in the path exist has read and write permission

1 Answers  


What does echo mean in scripting?

0 Answers  


What is inside a seashell?

0 Answers  


Categories