diff --git a/SC3028.md b/SC3028.md index 6310e11..ed7c210 100644 --- a/SC3028.md +++ b/SC3028.md @@ -22,6 +22,12 @@ echo "$(hostname) $(id -u) $(awk 'BEGIN { srand(); print int(rand()*32768) }' /d The variable you are attempting to use is a special variable in bash or ksh. To get the same information from `dash` or POSIX `sh`, use an external command instead. +For `PIPESTATUS`, the pipeline can be instrumented to record the exit value of each command: + +```sh +{ cmd0; echo $? > status0; } | { cmd1; echo $? > status1; } | cmd2 +``` + ### Exceptions: If you only intend to target shells that supports this feature, you can change