If you’re writing a
bash shebang recipe, consider adding
set -euxo pipefail:
foo: #!/usr/bin/env bash set -euxo pipefail hello='Yo' echo "$hello from Bash!"
It isn’t strictly necessary, but
set -euxo pipefail turns on a few useful features that make
bash shebang recipes behave more like normal, linewise
bashexit if a command fails.
bashexit if a variable is undefined.
bashprint each script line before it’s run.
set -o pipefailmakes
bashexit if a command in a pipeline fails. This is
bash-specific, so isn’t turned on in normal linewise
Together, these avoid a lot of shell scripting gotchas.
On Windows, shebang interpreter paths containing a
/ are translated from Unix-style paths to Windows-style paths using
cygpath, a utility that ships with Cygwin.
For example, to execute this recipe on Windows:
echo: #!/bin/sh echo "Hello!"
The interpreter path
/bin/sh will be translated to a Windows-style path using
cygpath before being executed.
If the interpreter path does not contain a
/ it will be executed without being translated. This is useful if
cygpath is not available, or you wish to pass a Windows-style path to the interpreter.