SC2240 – ShellCheck Wiki

See this page on GitHub


The dot command does not support arguments in sh/dash. Set them as variables.

Problematic code:

. include/myscript 80

Correct code:

#!/bin/sh port=80 . include/myscript 


In Bash and Ksh, you can use . myscript arg1 arg2.. to set $1 and $2 in the sourced script.

This is not the case in Dash, where any additional arguments are ignored, or in POSIX sh where the behavior is unspecified.

Instead, assign arguments to variables and rewrite the sourced script to read from them.



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