Bash basics: Difference between revisions
(Created page with "Bash certainly has its set of snafus. * To store commands in variables: <pre># NOTE don't put spaces around equals sign! # NOTE don't use ampersands within command strings, they...") |
No edit summary |
||
Line 3: | Line 3: | ||
* To store commands in variables: | * To store commands in variables: | ||
<pre># NOTE don't put spaces around equals sign! | <pre># NOTE don't put spaces around equals sign! | ||
# NOTE don't use ampersands within command strings, they won't work | # NOTE don't use ampersands within command strings, they won't work | ||
# use a blank command if needed, that's fine | |||
mycmd1="command param param" | mycmd1="command param param" | ||
mycmd2="cmd2 param" | mycmd2="cmd2 param" |
Revision as of 20:07, 26 January 2011
Bash certainly has its set of snafus.
- To store commands in variables:
# NOTE don't put spaces around equals sign! # NOTE don't use ampersands within command strings, they won't work # use a blank command if needed, that's fine mycmd1="command param param" mycmd2="cmd2 param" if [ -e /myspecialplace ] mycmd2="" fi mycmd3="cmd3 param" $mycmd1 && $mycmd2 && $mycmd3