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 batch file programming?
How to print all the arguments provided to the script?
Why is shell scripting important?
How will you find the 99th line of a file using only tail and head command?
How do you find out What is your shell?
Why is a script important?
What makes c shell a more preferable option than the bourne shell?
Explain about sourcing commands?
Why are shell scripts used?
What is shell prompt?
What is shell scripting?
Determine the output of the following command: name=shubham && echo ‘my name is $name’.
What happens on a system call?
Where is bash history?
Given a file find the count of lines containing the word "abc".