z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Quoting variable values

z/OS UNIX System Services User's Guide
SA23-2279-00

When you have blanks in a variable value, you need to enclose it in quotation marks. The quotation marks tell the shell to treat blanks as literals and not delimiters. Single quotation marks are more serious about this than are double quotation marks:
  • Single quotation marks preserve the meaning of (that is, treat literally) all characters.
  • Double quotation marks still allow certain characters ($, ` (backquote), and \ (backslash)) to be expanded. This is important if you want variable expansion. For example, see how the $ is handled here:
    setenv HOMEMSG "Using $HOME as Home Directory"
    If your home directory were set to /u/user, the following:
    echo $HOMEMSG
    would display:
    Using /u/user as home directory
    If, instead, you enclosed the variable value in single quotation marks, like this:
    setenv HOMEMSG 'Using $HOME as home directory'
    the following:
    echo $HOMEMSG
    would display:
    Using $HOME as home directory
    As you can see, the $ is not expanded.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014