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 does sh mean?

790


What is a command line shell?

760


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

737


Is shell a scripting language?

766


Explain about non-login shell files?

889


How will you emulate wc –l using awk?

1210


Explain about gui scripting?

830


Is powershell a language?

761


What is the difference between bash and shell?

836


How do I open the shell in cmd?

770


What are scripts in psychology?

785


What will happen to my current process when I execute a command using exec?

745


What is shell geeksforgeeks?

763


Can you write a script to portray how set –x works?

758


What is a shell environment?

749