refactor: set pipefail conditionally
This commit is contained in:
parent
827342f3e9
commit
f07ad2ce4e
|
@ -1,9 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 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
|
||||
if ! (set -o pipefail 2>/dev/null); then
|
||||
# dash does not support pipefail
|
||||
set -efx
|
||||
else
|
||||
set -efx -o pipefail
|
||||
|
|
Loading…
Reference in New Issue