-
Notifications
You must be signed in to change notification settings - Fork 1.9k
SC2112
Jordan Christiansen edited this page Jan 9, 2025
·
4 revisions
#!/bin/sh
function hello() {
echo "Hello World"
}#!/bin/sh
hello() {
echo "Hello World"
}The function keyword is a feature of Bash and Ksh, so code that uses it may be intended to be a Bash or Ksh script instead:
#!/bin/bash
function hello() {
echo "Hello World"
}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 instead declared without the function keyword as in the correct example.
None.
- Function Definition Command in the POSIX spec
- Shell Functions in the Bash manual