[GLLUG] Shell scripting weirdness
Robert McKay
robert at mckay.com
Wed May 22 22:30:16 UTC 2013
Greetings fellow Lugites,
I was wondering if anyone knows why these two commands behave
differently;
bash -c "cat & wait"
bash -c "cat <&0 & wait"
The first just exits right away. The second one does what I
wanted/expected the first one to do.
also when running the same bash shell in sh-compat mode;
sh -c "cat <&0 & wait"
it behaves like the first one and on a ksh shell "(cat & wait)" by
itself worked.. unfortunately I don't have the exact version of ksh
handy and my attempts to repeat that one here have failed.
The problem I was actually trying to solve has already been dealt with
and this is a simplified demonstration of what I was actually doing -
it's just been annoying me all afternoon as I couldn't see why they
should behave differently.. other than just 'because' :p
Cheers,
Rob
More information about the GLLUG
mailing list