diff --git a/src/script.sh b/src/script.sh index 84ac542..6181713 100644 --- a/src/script.sh +++ b/src/script.sh @@ -1,14 +1,19 @@ #!/bin/sh -## dash does not support pipefail +# dash does not support pipefail # this does not work in `dash script.sh` -DASH=$(readlink -f "/bin/sh" | grep "dash" || [ $? = 1 ]) -if [ -n "$DASH" ]; then +IS_DASH=$(readlink -f "/bin/sh" | grep "dash" || [ $? = 1 ]) +if [ -n "$IS_DASH" ]; then set -efx else set -efx -o pipefail fi +# bash does not expand alias by default for non-interactive script +if [ -n "$BASH_VERSION" ]; then + shopt -s expand_aliases +fi + ## Use GNU grep, busybox grep is not as performant DISTRO=""