write a shell script to find the largest number from 3 given
numbers.
Answer Posted / aseem
Hi Imran,
Could you please run your script with below parameter
4 45 1. It will give the output as "1 is the largest number"
reason is you have used only sort command not sort -nr so it will not sort in reverse order, so in your case head -1 will rather than tail -1.
Hi A,
Regarding your answer you have to run by below way.
say you are keeping your script in file test.sh
then
sh test.sh 43 1 34
Actually it takes the positional parameter so after script whatever input you provide it takes as parameter.
Feel free to send me email aseem02@gmail.com if you have any doubt regarding shell scripting, will glad to help you guys.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Write a shell script to get current date, time, user name and current working directory.
What are the disadvantages of shell scripting?
How do you create a shortcut in linux?
What is a shell environment?
Which is better perl or shell scripting?
what is info area how many types?
What does $0 mean in shell script?
Why are shell scripts used?
What is the significance of the shebang line in shell scripting?
What is the default shell of solaris?
Given a file find the count of lines containing the word "abc".
What is bash shell command?
Is powershell a language?
Where are cowrie shells found?
What does chmod do?