Tutorial by Examples

A newline can be included in a single-string or double-quoted string. Note that backslash-newline does not result in a newline, the line break is ignored. newline1=' ' newline2=" " newline3=$'\n' empty=\ echo "Line${newline1}break" echo "Line${newline2}break" ...
Variable substitutions should only be used inside double quotes. calculation='2 * 3' echo "$calculation" # prints 2 * 3 echo $calculation # prints 2, the list of files in the current directory, and 3 echo "$(($calculation))" # prints 6 Outside of doubl...
All the examples in this paragraph print the line !"#$&'()*;<=>? @[\]^`{|}~ A backslash quotes the next character, i.e. the next character is interpreted literally. The one exception is a newline: backslash-newline expands to the empty string. echo \!\"\#\$\&\'\(\)\*\;\...
Double quoteSingle quoteAllows variable expansionPrevents variable expansionAllows history expansion if enabledPrevents history expansionAllows command substitutionPrevents command substitution* and @ can have special meaning* and @ are always literalsCan contain both single quote or double quoteSin...

Page 1 of 1