function command in Linux with examples
Function is a command in linux which is used to create functions or methods.
- using function keyword : A function in linux can be decalred by using keyword function before the name of the function. Different satements can be separated by a semicolon or a new line.
SYNTAXfunction name { COMMANDS ; }
- using parenthesis : A function can also be decalred by using parenthesis after the name of the function. Different satements can be separated by a semicolon or a new line.
SYNTAXname () { COMMANDS ; }
- Parameterised function :
$1 will displays the first argument that will be sent and $2 will display the second ans so on… - help function : It displays help information.
Join the conversation