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 bash coding?
How to get script name inside a script?
What is k shell?
I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?
What is the purpose of scripting?
What does $0 mean in shell script?
How does path variable work?
What is shell environment?
Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.
How can you find out how long the system has been running?
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 ?
write a shell script to check the failed jobs?
how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?
How to check if a directory exists?
How do I run a script from command prompt?