Grouping Elements with Double Quotes
Like braces, double quotes also group elements together. But unlike braces, double quotes cannot be nested. Furthermore, while braces disable almost all special characters, double
quotes disable just a few - spaces, tabs, newlines and semicolons - letting you avoid the potentially awkward use of backslashes in a string of text elements. The most convenient use of double
quotes is to allow clean, readable expansion of variables using the dollar sign ($) trigger. For instance, in the following example we set a variable (a) to a value that includes spaces.
dcecp> set a "XYZ server for /.:/corp/comm_groups" XYZ server for /.:/corp/comm_groups dcecp> puts $a XYZ server for /.:/corp/comm_groups
dcecp>
Use of double quotes does not disable command, variable, and backslash substitution. Let us look at a variation of the example used in the previous topic on braces.
dcecp> set a solution solution dcecp> puts $a solution dcecp> puts "This is a convenient $a." This is a
convenient solution. dcecp>
In this example, the use of quotes with the second puts command gathers five elements into a single argument for puts by disabling special interpretation of the space characters.
However, the quotes do not affect interpretation of the $ character.
|