fix: dash does not support pipefail

This commit is contained in:
MDLeom 2023-05-20 10:38:47 +00:00
parent eac902123e
commit 13289d3365
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 8 additions and 3 deletions

View File

@ -1,8 +1,13 @@
#!/bin/sh
# works best on busybox ash
set -efx -o 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
set -efx
else
set -efx -o pipefail
fi
alias curl="curl -L"
alias rm="rm -rf"