[Help-bash] How to get all the return status in an assignment statement?
From:
Peng Yu
Subject:
[Help-bash] How to get all the return status in an assignment statement?
Date:
Tue, 24 Mar 2015 17:32:06 -0500
Hi,
The following code shows that I can only get the return status of the
last $(). Is there a way to get all the return status like the way
with PIPESTATUS?
#!/usr/bin/env bash
x=$(echo x; exit 1) || echo $?
echo "^$x\$"
x=$(echo x; exit 1)/$(echo y z; exit 2) || echo $?
echo "^$x\$"
x=$(echo x; exit 1)/$(echo y z) || echo $?
echo "^$x\$"
--
Regards,
Peng