Say I want to touch mickymouse in /tmp
I can do
cd /tmp ; touch mickymouse
or I can do
cd /tmp && touch mickymouse
I’m not clear what the subtle (or less subtle) differences are between the two statements.
Would appreciate comments on the difference between the two.
Thanks.
;terminates the statement whereas&&is the logical AND.In the above, even if
cd /tmpfailed,touch mickymousewill still be executed.In the second one,
Do
touch mickymouseonly ifcd /tmpsucceeded