fix: expand alias in bash

This commit is contained in:
MDLeom 2024-06-03 08:21:56 +00:00
parent 358003b782
commit 827342f3e9
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 6 additions and 4 deletions

View File

@ -1,16 +1,18 @@
#!/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
# shopt -s expand_aliases
if [ -n "$BASH_VERSION" ]; then
shopt -s expand_aliases
fi
alias curl="curl -L"
alias rm="rm -rf"