Bash:Function: Difference between revisions
Jump to navigation
Jump to search
Created page with "category:Bash category:Linux/Unix ;function <naam> { cmdlist } :Define a function (subroutine), must be run by the script before you can call it. :A function is calle..." |
mNo edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[ | [[Category:Linux/Unix]] | ||
;function <naam> { cmdlist } | ;function <naam> { cmdlist } | ||
Latest revision as of 09:40, 20 January 2022
- function <naam> { cmdlist }
- Define a function (subroutine), must be run by the script before you can call it.
- A function is called by the function name and eventual parameters. Parameters are positional like when you call a scripts ($1, $2,...). Variables that already exist when you call the functions are global.
- typeset VAR=<value>
- Define local variables in a function.
- Functions can be made available in the loginshell by defining them in the $ENV script or by putting the script in $FPATH.
- unset -f <function>
- Undefine function