Lesson - 11 : Shell Scripting - Shell Functions in Unix

preview_player
Показать описание
Using functions to perform repetitive tasks is an excellent way to create code reuse. This is an important part of modern object-oriented programming principles.

Shell functions are similar to subroutines, procedures, and functions in other programming languages.

Creating Functions
To declare a function, simply use the following syntax −

function_name () {
list of commands
}
The name of your function is function_name, and that's what you will use to call it from elsewhere in your scripts. The function name must be followed by parentheses, followed by a list of commands enclosed within braces.
Рекомендации по теме
visit shbcf.ru