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...

write a shell script to find the largest number from 3 given
numbers.

Answer Posted / aseem

Hi Imran,

Could you please run your script with below parameter
4 45 1. It will give the output as "1 is the largest number"
reason is you have used only sort command not sort -nr so it will not sort in reverse order, so in your case head -1 will rather than tail -1.

Hi A,

Regarding your answer you have to run by below way.

say you are keeping your script in file test.sh
then

sh test.sh 43 1 34

Actually it takes the positional parameter so after script whatever input you provide it takes as parameter.

Feel free to send me email aseem02@gmail.com if you have any doubt regarding shell scripting, will glad to help you guys.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is cmd a shell?

1028


What is shell terminal?

958


What is scripting autism?

1215


What is the lifespan of a variable inside a shell script?

1659


Why is shell scripting important?

1044


Write a shell script that adds two numbers if provided as the command line argument and if the two numbers are not entered throws an error message.

1288


What are script files?

1038


What is a program shell?

1049


What is scripting used for?

1045


How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?

1104


What is the use of .sh file?

1122


What does $$ mean in shell script?

1058


What is gui scripting?

1109


How important is shell scripting?

1047


How will you copy a file from one machine to other?

1006