Command Line Functions #
Shell functions #
Standard syntactic forms:
function name {
commands
return
}
or
name () {
commands
return
}
Local variables #
Shell functions can have local variables internal to the function itself by prepending the variable with local.
funct_1 () {
local foo
foo = "something"
echo "$foo"
}
In your .bashrc #
Neat little trick: putt a shell function in your .bashrc file for custom little functions to be used at the command line.