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 shell scripting a language?

1032


Why should we use shell scripts?

1048


What is shell geeksforgeeks?

1099


Explain how you Automate your application using Shell scripting.

2307


Is shell scripting useful?

1039


What can scripts do?

1095


What are the disadvantages of shell scripting?

1189


c program the catches the ctrl-c(SIGINT) Signal for the first time and prints a output rather and exit on pressing Ctrl-C again

6430


Write the syntax for "if" conditionals in linux?

1110


What does $0 mean in shell script?

993


Explain about login shell?

1112


Which scripting language is best for automation?

953


What is the significance of $#?

1097


What command needs to be used to take the backup?

982


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

997