How do i combine commands like for example if i wanted to combineandCode:cd /homeconsecutively. Is there a specific symbol or something of the sort?Code:cd /media
How do i combine commands like for example if i wanted to combineandCode:cd /homeconsecutively. Is there a specific symbol or something of the sort?Code:cd /media
There is a syntax to
a) Run commands one after the other (only if the command before it is successful)
b) Run commands all at once.
a) uses "&&"
For example,
That would run one command after the otherCode:cd /root && touch test && touch test2
b) uses "&"
For example
That would run all of them at once, and would probably not be advisable.Code:cd /root & touch test & touch test2
Don't waste your energy trying to change opinions ... Do your thing, and don't care if they like it.
Thanks a lot this will help with my bash tutorial
Last edited by vokevybez; July 6th, 2012 at 03:03 PM.
c) Run the commands sequentially, regardless if the previous command in the chain was successful or not: use the semicolon.
Code:cd /home ; ls -l ; cd /root ; ls -l
Most of the information has been presented here for you but the gruesome details can be seen in the bash man pages under 'Lists'.
You think that's air you're breathing now?
Another well written man page is the 'find' page, pity they are all not as well done .
You think that's air you're breathing now?
Bookmarks