Hey all,
I have a bash script that runs this command:
Code:
./myExpTest.exp $1 $2 | tee ~/Documents/Expect_script/new/myTestTee.txt
EXPECT_RETCODE=${PIPESTATUS[0]}
TEE_RETCODE=${PIPESTATUS[1]}
echo $EXPECT_RETCODE
echo $TEE_RETCODE
The command executes (with or without errors) and the exit status echoed to the screen is only the $EXPECT_RETCODE. But it also echos a empty line under the first echo, where the 2nd exit status should be.
Anyone know why it isn't returning the 2nd exit status to me?
I also tried this: (instead of the above example)
Code:
./myExpTest.txt $1 $2 | tee ~/Documents/Expect_script/new/myTestTee.txt
echo ${PIPESTATUS[*]}
echo ${PIPESTATUS[0]}
echo ${PIPESTATUS[1]}
The command above executes and:
the first echo with '*' gives me: "0 0" --> which is correct
the second echo with '0' gives me: "0" --> also correct
the third echo with '1' gives me: " " --> echos nothing
Anyone know why this is happening? Am I using it correctly?
Thanks in advance,
Matt