[Next] [Previous] [Up] [Top] [Contents]

CHAPTER 9 Shell Programming

9.2 Setting Parameter Values


Parameter values, e.g. param, are assigned as:

Bourne shell C shell

param=value set param = value

where value is any valid string, and can be enclosed within quotations, either single ('value) or double ("value"), to allow spaces within the string value. When enclosed with backquotes ('value') the string is first evaluated by the shell and the result is substituted. This is often used to run a command, substituting the command output for value, e.g.:

$ day='date +%a'

$ echo $day

Wed

After the parameter values has been assigned the current value of the parameter is accessed using the $param, or ${param}, notation.


Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]