From 3cc680f3bcc6c20aca3e83967c846aa823a750b5 Mon Sep 17 00:00:00 2001 From: MDLeom <2809763-curben@users.noreply.gitlab.com> Date: Mon, 3 Jun 2024 08:21:16 +0000 Subject: [PATCH] fix: expand alias in bash --- src/script.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/script.sh b/src/script.sh index 9a2dbb1..22d5567 100644 --- a/src/script.sh +++ b/src/script.sh @@ -2,9 +2,19 @@ #!/bin/sh -# works best on busybox ash +# dash does not support pipefail +# this does not work in `dash script.sh` +IS_DASH=$(readlink -f "/bin/sh" | grep "dash" || [ $? = 1 ]) +if [ -n "$IS_DASH" ]; then + set -efx +else + set -efx -o pipefail +fi -set -efux -o pipefail +# bash does not expand alias by default for non-interactive script +if [ -n "$BASH_VERSION" ]; then + shopt -s expand_aliases +fi alias cp="cp -f" alias curl="curl -L"