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 does sh mean?
What is a command line shell?
What makes c shell a more preferable option than the bourne shell?
Is shell a scripting language?
Explain about non-login shell files?
How will you emulate wc –l using awk?
Explain about gui scripting?
Is powershell a language?
What is the difference between bash and shell?
How do I open the shell in cmd?
What are scripts in psychology?
What will happen to my current process when I execute a command using exec?
What is shell geeksforgeeks?
Can you write a script to portray how set –x works?
What is a shell environment?