12.07.2015 Views

Advanced Bash-Scripting Guide

Advanced Bash-Scripting Guide

Advanced Bash-Scripting Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Advanced</strong> <strong>Bash</strong>-<strong>Scripting</strong> <strong>Guide</strong>',\partial quoting [double quote]. "STRING" preserves (from interpretation) most of the specialcharacters within STRING. See also Chapter 5.full quoting [single quote]. 'STRING' preserves all special characters within STRING. This is astronger form of quoting than using ". See also Chapter 5.comma operator. The comma operator [15] links together a series of arithmetic operations. All areevaluated, but only the last one is returned.let "t2 = ((a = 9, 15 / 3))" # Set "a =9" and "t2 = 15 / 3"escape [backslash]. A quoting mechanism for single characters.\X "escapes" the character X. This has the effect of "quoting" X, equivalent to 'X'. The \ may be usedto quote " and ', so they are expressed literally./`:See Chapter 5 for an in-depth explanation of escaped characters.Filename path separator [forward slash]. Separates the components of a filename (as in/home/bozo/projects/Makefile).This is also the division arithmetic operator.command substitution. The `command` construct makes available the output of command forassignment to a variable. This is also known as backquotes or backticks.null command [colon]. This is the shell equivalent of a "NOP" (no op, a do-nothing operation). Itmay be considered a synonym for the shell builtin true. The ":" command is itself a <strong>Bash</strong> builtin, andits exit status is "true" (0).:echo $? # 0Endless loop:while :dooperation-1operation-2...operation-ndone# Same as:# while true# do# ...# donePlaceholder in if/then test:if conditionthen : # Do nothing and branch aheadelseChapter 3. Special Characters 10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!