-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC2113
Vidar Holen edited this page Jul 25, 2021
·
4 revisions
#!/bin/sh
function hello {
echo "Hello World"
}
#!/bin/sh
hello() {
echo "Hello World"
}
### Rationale:
`function` is a non-standard keyword that can be used to declare functions in Bash and Ksh.
In POSIX `sh` and `dash`, a function is defined without a `function` keyword. Instead, the function name is followed by `()` as in the correct example.
### Exceptions:
None
### Related resources:
* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!