()
and refer to params as $1
, $2
, ..foo(input) {
echo "$input"
}
foo("hello world");
foo() {
echo "$1"
}
foo "hello world"
Shell script functions behave just like scripts and other commands:
$1
, $2
etc. They can not declare parameters by name.name arg1 arg2
, and not with parentheses as C-like languages.None.
ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.