3 ms·
I am surprised that this is working, as I always thought that variables get initialized after the full command is parsed. So, I would assume that $_ would be re
by alkh 2y ago
I am surprised that this is working, as I always thought that variables get initialized after the full command is parsed. So, I would assume that $_ would be related to the previous command (defined by a new line) and not this one, because there's no newline character here, but only an ampersand.
- godelski 2y ago&& means there's a sequence. So the second statement will only execute conditioned on the first sequence. So... > thisFunctionFails && echo "Hello world" && echo "I SAID $_" > thisFunctionSucceeds && echo "Hello world" && echo "I SAID $_" Hello World I SAID Hello World The left function has to get evaluated before the next function. So it is still related to the previous command.