Skip to content
koalaman edited this page Dec 6, 2015 · 1 revision

You need a space or linefeed between the function name and body.

Problematic code:

function foo{
  echo "hello world"
}

Correct code:

Prefer POSIX syntax:

foo() {
  echo "hello world"
}

Alternatively, add the missing space between function name and opening {:

#           v-- Here
function foo {
  echo "hello world"
}

Rationale:

When using function keyword function definitions without (), a space is required between the function name and the opening {.

Exceptions:

None.

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally