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
What is $1 in shell scripting?
What is a shell script? Can you name some of its advantages?
Set up a Sev 2 alert when the Primary WA service fails. A windows batch script needs to be created that will monitor the WA service on the Primary and when the service stops/fails a Sev 2 TT is generated for a particular team ?
What is the difference between grep and egrep?
Is scripting and coding the same thing?
What is the conditional statement in shell scripting?
How will you emulate wc –l using awk?
What is the equivalent of a file shortcut that we have a window on a linux system?
What is basename in shell script?
What does it mean to debug a script?
How do I run a bin bash script?
What is meant by $1 in shell script?
What are zombie processes?
How does ls command work?
is this growing field and what is average package in this?