fix: expand alias in bash

This commit is contained in:
MDLeom 2024-06-03 08:21:16 +00:00
parent 90d191c6df
commit 3cc680f3bc
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 12 additions and 2 deletions

View File

@ -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"