Translations:Aliases in .bashrc/2/en

Revision as of 16:14, 29 December 2022 by FuzzyBot (talk | contribs) (Importing a new version from external source)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The syntax for creating a bash function is very easy. They can be declared in two different formats:

~/.bashrc
...
function_name () {
  [commands]
}
...

or

~/.bashrc
...
function function_name {
  [commands]
}
...

To pass any number of arguments to the bash function simply, put them right after the function’s name, separated by a space. The passed parameters are $1, $2, $3, etc., corresponding to the position of the parameter after the function’s name. The $0 variable is reserved for the function name.