Actually, && runs the second command if the first command succeeded (exited without an error code posted). || runs the second command if the first returns an error code.
So
mplayer something.ogg && vim
would run vim IF mplayer exited without an error
mplayer something.ogg || vim
would run vim IF mplayer exited with an error
mplayer something.ogg & vim
runs mplayer, then forks it to a background task (it can still output to stdout, equivalent to `Z bg') and runs vim
View all comments
Show parent comment
2
u/Filmore May 30 '08 edited May 30 '08
Actually, && runs the second command if the first command succeeded (exited without an error code posted). || runs the second command if the first returns an error code.
So
would run vim IF mplayer exited without an error
would run vim IF mplayer exited with an error
runs mplayer, then forks it to a background task (it can still output to stdout, equivalent to `Z bg') and runs vim
A common script sequence is