r/programming • • May 29 '08

Best background music for programming?

291 Upvotes

985 comments sorted by

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

 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

A common script sequence is

 some command here || some command for error case