Skip to content

Commit

Permalink
fix: expand alias in bash
Browse files Browse the repository at this point in the history
  • Loading branch information
MDLeom committed Jun 3, 2024
1 parent 358003b commit 827342f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/script.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 827342f

Please sign in to comment.