Shell FunctionsWith the help of functions, overall functionality of a function can be divided into smaller or logical parts, which can be called to perform their task. It helps us to check our program part by part. We can reuse the function where ever we want. To create a function Syntax: You will call your function with their function name. Example: ![]() Look at the above snapshot, we have created a function Welcome. We have called it in the above script. ![]() Look at the above snapshot, on executing the above script, function Welcome is called. Passing ParametersYou can pass one or more parameters in a function. Parameters will be defined as $1, $2 and so on. ![]() Look at the above snapshot, $1 is a parameter passed to the function. ![]() Look at the above snapshot, script produces the above output.
Next TopicSS Case
|