Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: x86_64-pc-linux-gnu-gcc Compilation CFLAGS: -march=native -ggdb -O2 -pipe uname output: Linux urania 6.6.62-gentoo #1 SMP Wed Nov 20 14:40:27 CET 2024 x86_64 AMD Ryzen 7 PRO 7730U with Radeon Graphics AuthenticAMD GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.2 Patch Level: 37 Release Status: release Description: For a compound command like "if" or "while" and with an unsuccessful test, the last element of PIPESTATUS is not the return status of the compound but that of the test command. For example, "if false; then :; fi" returns 0 but ${PIPESTATUS[0]} is 1. If the pipeline consists of more than one command, like "if false; then :; fi | true" or "true | if false; then :; fi" then it behaves as I would expect, i.e. all elements of PIPESTATUS are zero. Repeat-By: $ if false; then :; fi $ echo "ret = $?, status = ${PIPESTATUS[*]}" ret = 0, status = 1