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 shell company all about?
What is the command to find out users on the system?
write a shell script to emulate the Id command of PRIMOS which lists files and directories. It list files first with a header FILES and then directories with a header DIRECTORIES. This command has several options. The main ones are. -file select files only -dir select directories only -reverse sort in reverse order -no_header put no header on the output -brief output the header only -size display the size of each file -help display Id´s syntax and options.
How do I start a shell script?
What does egrep mean?
how will you find the total disk space used by a specific user?
What lives in a shell?
How to redirect both standard output and standard error to the same location?
Which is better perl or shell scripting?
determine the output of the following command: echo ${new:-variable}
What are filters explain sort with all the options available?
What's the difference between scripting and coding?
What does it mean by #!/Bin/sh or #!/Bin/bash at the beginning of every script?
How does ls command work?
What are the types of script?