ac_dispatcher Posted April 28, 2004 Report Share Posted April 28, 2004 (edited) I just bought my forth Linux book on Sunday (April 25 my birthday). I know their is a lot of stuff free on the web but I just wanted some good reference books. I now have Linux Server Hacks <---great book Linux Power Tools Linux Pocket Guide Essential System Admin Pocket Reference Inspired by VeeDubb and I have decided to try a weekly/bi-weekly "AC's stupid tricks". A sort of newbie guide to some common things they may see. (maybe a little advanced to). This week is Combining Commands (Linux Pocket Guide pg 26) A lot of times you will come across some instructions that have lets say a "&&" in it. What does that mean/do? Here ya go - Their are three basic ways you'll see commands combined: $ command1 ; command2 ; command3 or $ command1 && command2 && command3 <----- I have found this most common or $ command1 || command2 || command3 Explanation: $ command1 ; command2 ; command3 The semi colon ";" is used to separate the commands. This command will invoke several commands in sequence. $ command1 && command2 && command3 Now we have used a "&&" instead. This will also invoke a set of commands in sequence. The difference? It will stop execution if any command fails. $ command1 || command2 || command3 Last is the "||" used to separate them. This will run a sequence of commands , stopping execution as soon as one succeeds. Well I did not set out to tell you how you use these commands - thats for you to learn :P but hopefully you will know the use of ; or && or || in combining commands. Maybe some of the kind board folk can give some common examples? Edit: Not sure if this would be a "Tip" or "Trick". Not really sure where this post may belong. Mods / Admins feel free to move it. Thanks guys. Edited April 28, 2004 by ac_dispatcher Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.