Take the 2-minute tour ×

I've queued a backgrounded command via

command 1 && command 2 &

command 1 is currently running, however I need to make sure command 2 is never executed.

If I need to kill command 1 in order to ensure this, that is fine.

Is this possible?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

If you want to kill command1, then that will work. Otherwise you may be able to just rename command2 to something else - then when the shell tries to execute it, it won't find the command:

$ mv command2 command2.old
share|improve this answer
so killing the PID of command 1 will cause command 2 to never execute? –  pstanton Mar 31 '11 at 21:40
Yes, that's what the && does. If you wanted it to continue even if command1 doesn't complete successfully, you'd replace && with ||. –  EEAA Mar 31 '11 at 21:41
ah nice. the old logical operator. learn something every day! –  pstanton Mar 31 '11 at 21:44

Your Answer


