SC3003 – ShellCheck Wiki

See this page on GitHub


In POSIX sh, $'..' is undefined.

Problematic code:

IFS=$' \t\n'

Correct code:

# Note: \n can not be last, or it will be stripped by $()
IFS=$(printf ' \n\t')


# Trailing linefeed added literally
IFS="$(printf ' \t')


# Bash supports this
IFS=$' \t\n'


You are using the interpolated string Bashism $'..' in a script that declares itself as POSIX sh (e.g. via #!/bin/sh).

To ensure the script runs correctly on other systems, either switch to Bash, or rewrite it in a POSIX compatible way.

This can generally done via printf as in the example. Be careful about strings with trailing linefeeds, as a $(command substitution) will strip them.



ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.