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 / vipul dalwala

In continuation to above answer.

If you want to write a script in more generic way.

if [ $# -eq 0 ]
then
echo "$0: numbers are not given" >&2
exit 1
fi
LARGEST=$(echo $* | xargs -n1 | sort -nr | tail -1)
echo "$LARGEST is largest number"

Is This Answer Correct ?    13 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is batch file programming?

1151


How to print all the arguments provided to the script?

949


Why is shell scripting important?

1034


How will you find the 99th line of a file using only tail and head command?

2530


How do you find out What is your shell?

1053


Why is a script important?

1053


What makes c shell a more preferable option than the bourne shell?

969


Explain about sourcing commands?

1082


Why are shell scripts used?

1068


What is shell prompt?

1015


What is shell scripting?

1043


Determine the output of the following command: name=shubham && echo ‘my name is $name’.

977


What happens on a system call?

1004


Where is bash history?

912


Given a file find the count of lines containing the word "abc".

1548