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 shift command in shell script?
What makes c shell a more preferable option than the bourne shell?
What is the first line in every perl script called?
What is ms powershell?
How do I run a .sh file on mac?
What is @echo off?
How will you emulate wc –l using awk?
Why is the use of shell script?
Explain about the slow execution speed of shells?
I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?
What are the two files of crontab command?
In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?
What are scripts in psychology?
How do I read a .sh file?
Is bash a shell script?