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
Why is the use of shell script?
Which shell is the best?
What are the default permissions of a file when it is created?
How do we delete all blank lines in a file?
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 ?
c program to display the information of given file similar to givan by the unix or linux command ls -l
Is shell scripting a language?
Hello all, This is my assignment on shell scripting, can anyone help me regarding this ? Create a shell script which connects to the database In second shell script include the first script for the DB connection Create a table (PRADEEP_DATA) with 2 columns (name, value) In Third shell script include the first script for the DB connection And insert/delete the values from the Table, by accepting input from the user This functionality should be a menu driven Program: 1) Insert to the database a. Name b. value 2)Delete from the database a.Name b.value Exception handling needs to be taken care.
What language is used in terminal?
What is the significance of $#?
How can you get the value of pi till a 100 decimal places?
Is powershell a bash?
What is meant by $1 in shell script?
What is shell scripting used for?
What command needs to be used to take the backup?