I am setting a variable like this:myvar=$(command --params)I want to check the exit code ($?) of my command afterwards.  Checking $? like this always returns 0 because it successfully set the variable to the output of the command.Is it possible to get the return value of command?
Can I get the exit code from a sub shell launched with $(command)?
bash;shell script;command substitution;return status
Yes, it is possible without even getting too far out of your way:$ $(exit 3); echo $?3$ foo=$(echo bar; exit 3); echo $?; echo $foo3bar