When I run
curl | tee test.txt; echo ${PIPESTATUS[0]}
I correctly see
curl: try 'curl --help' or 'curl --manual' for more information
2
But when I try to run exactly same command using '/bin/sh':
sh -c "curl | tee test.txt; echo \${PIPESTATUS[0]}"
I get
curl: try 'curl --help' or 'curl --manual' for more information
sh: 1: Bad substitution
How we can resolve Bad substitution
problem, please?
sh -c "<your above link answer's scripts here>"
?