Write a shell script to find out the largest value from the given number of command-line arguments.
Special variables in bash:
$@- All arguments. $#- Number of arguments. $0- Filename. $1, $2, $3, $4 ... - Specific arguments.
- If the number of arguments is 0, end the program.
- If not zero, then
- Initialize a variable maxEle with first argument.
- Loop over all the arguments. Compare each argument with maxEle and update it if the argument is greater.
- Bash shell script to find sum of digits
- Bash shell script to swap two numbers
- Write a bash script to print a particular line from a file
- How to find time taken by a command/program on Linux Shell?
- Conditional Statements | Shell Script
- Looping Statements | Shell Script
- String Operators | Shell Script
- Bash Script to get Low Battery Alert in Linux
- Implementing Directory Management using Shell Script
- How to Fix Minimal BASH Like Line Editing is Supported GRUB Error In Linux?
- script command in Linux with Examples
- Introduction to Linux Shell and Shell Scripting
- How to Download YouTube Videos in Linux Command Line?
- Bash program to find A to the power B
- A Shell program To Find The GCD | Linux
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.