Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Use perl:
perl -e '$a=shift; `<< other code >>`; exit $a' $? # Fails in csh
Edit This works in csh, too (and zsh, tcsh, sh, pdksh, ksh93 - though not fish):
perl -e '$a=shift; `<< other code >>`; $a=~s/h// and exit $a; exit shift' "$?h" "$status"
Edit This works in csh, too (and zsh, tcsh, sh, pdksh - though not fish):
Edit This works in csh, too:
perl -e '$a=shift; `pwd`;`<< other code >>`; $a=~s/h// and exit $a; exit shift' "$?h" "$status"
perl -e '$a=shift; `pwd`; $a=~s/h// and exit $a; exit shift' "$?h" "$status"