Created
August 30, 2012 20:44
-
-
Save ninjudd/3540448 to your computer and use it in GitHub Desktop.
Command substitution hangs if the command starts a process in the background.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo=$(./foo.sh) | |
echo "foo is '$foo'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yes > /dev/null & | |
disown %- | |
echo "yes started" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Only works if we redirect
yes
to/dev/null
. This is obvious in the case ofyes
since it spews a bunch of output, but not so obvious for commands that may not output anything.