ksh - Why is this pipeline behave differently in ksh93 compared to bash? -
i had issue ksh93 code. complex started reducing example code reproduce same issue. ended this:
set -o pipefail; { echo "progress" 1>&3 | false } 3>&1 | cat | \ while read pv_output; echo "meanwhile ... got " echo $pv_output | cat done echo $? when run code ksh93 outputs "0", when run bash outputs "1".
# echo "ksh93";ksh93 ./x1.sh ;echo "bash"; bash ./x1.sh ksh93 meanwhile ... got progress 0 bash meanwhile ... got progress 1 however if start fiddling code, , remove first cat, both shells return "1"
set -o pipefail; { echo "progress" 1>&3 | false } 3>&1 | \ while read pv_output; echo "meanwhile ... got " echo $pv_output | cat done echo $? or... if leave in first cat, remove second 1 inside while, work same way again.
set -o pipefail; { echo "progress" 1>&3 | false } 3>&1 | cat | \ while read pv_output; echo "meanwhile ... got " echo $pv_output done echo $? now, example used cat simplicity's sake. in real life first cat awk processing output of complicated command. second cat sed. mention these, clear cat command in not culprit.
Comments
Post a Comment