Open sjackman opened 6 years ago
The default shell used by GNU Make is $SHELL $.SHELLFLAGS
where SHELL=/bin/sh
and .SHELLFLAGS=-c
or .SHELLFLAGS=-ec
in POSIX compatibility mode. I prefer -ec
myself. See https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html
I didn't know this:
Unlike most variables, the variable SHELL is never set from the environment. This is because the SHELL environment variable is used to specify your personal choice of shell program for interactive use. It would be very bad for personal choices like this to affect the functioning of makefiles. See Variables from the Environment.
https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html
So SHELL
has to be specified in the Makefile
.
The Python example would give almost-free SnakeMake compatibility (modulo one parser). This, with a couple other features like provenance, seems noteworthy enough for publication (to me at least), which is a good driver of issue prioritization IMO. So this issue just increased in appeal/priority 👍
Cool idea! .SHELLFLAGS
is useful for other interpreters that use e.g. -e
rather than -c
.
https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html
Changing the shell to either
bash -o pipefail
orzsh -o pipefail
is useful to catch a failed intermediate stage of a pipe. For example by defaultcat non-existant-file | gzip >$@
is successful because thegzip
is succesful, even thoughcat
failed. Setting-o pipefail
causes this pipe to fail correctly.It's also useful to use
zsh
to time every command that's run bybiomake
like so:Usually
SHELL
is used to changed the shell from the default/bin/sh
to sayzsh -o pipefail
, but here's a fun example changing it topython
.