Shellcheck Support

Source Directive

1
source "$(dirname "${BASH_SOURCE[0]}")/../other.sh"

BashSupport Pro supports Shellcheck’s source directive. This directive is useful for filenames, which are not static. ../other.sh is a static value, but "$(dirname "${BASH_SOURCE[0]}")/../other.sh" is not. Shellcheck and BashSupport Pro only understand static values.

If you use a dynamic value in script, then you can use the shellcheck source directive to define the static location:

1
2
# shellcheck source=../other.sh
source "$(dirname "${BASH_SOURCE[0]}")/../other.sh"

BashSupport Pro assumes that the source path is relative to the current file. By default, Shellcheck uses the directory where it’s executed as root for source paths. Use the source-path directive or execute shellcheck -P ... if this is a problem in your setup.

Go to Declaration
You can navigate to the source files by ctrlclick or by using the NavigateGo to Declaration action.
Rename
The source= path is updated when you rename the referenced file. It’s also updated when you move the file, which contains the source directive.