Really old sh -- pipefail

Hal Murray halmurray at sonic.net
Wed Sep 9 11:16:01 UTC 2026


I'm trying to understand this code from tests/option-tester.sh

# set pipefail to catch pipeline failures
# Unfortunately, it doesn't work on some older sh-es
if (set -o pipefail) 2>/dev/null
then
  set -o pipefail
fi

What is the () doing there?  Why not just set it and ignore the error if 
that doesn't work?

I no longer have any systems that are old enough to have a sh that doesn't 
support pipefail.

Does anybody have an old sh to experiment with?


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list