I'm looking for a way to shorten this piece of code to remove the echo $? part.
case 0 in
$( [[ -e /path/to/file/a ]]; echo $?) ) echo a ;;
$( [[ -e /path/to/file/b ]]; echo $?) ) echo b ;;
esac
It feels like bash should have a way to expand to a commands exit value without having to have an extra echo statement included.
I've spent a good 30 minutes Googling command expansion, but I didn't find anything that would eliminate the echo from the above example.
Possibly it's just wishful thinking, but in any case I'd love to have a definite answer and or hear any comments.