set variable_name = variable_value (C-shells)
You can clear this value by using the unset command.
You can assign the output of a command to a variable by using backwards single quotes around the command itself. For example,
malama% set prompt = ```hostname`% ''
will set up your prompt to include the name of the system you are logged onto, which is obtained using the command hostname.
Variables can come in very handy. For instance, if there is a directory which has a long pathname, that you use quite often, then you could set up a variable for it. E.g.:
malama% set text = /usr/dict/papers Now, if you wish to refer to this directory you can use the variable name instead:
malama% cd $text
/usr/dict/papers
To show the contents of a variable use the echo command in the following form:
malama% echo $text
/usr/dict/papers
Note how similar variable substitutions, both environmental and others, are to logical names in VMS.
There are some special variables in the shells. In the C-shells, for example, there is ``prompt'' (see above), and there is ``echo'' (no connection to echo described above). If you put the command set echo at the beginning of a shell script, every command will be echoed to the standard output. Be sure to put unset echo at the end if you are going to be executing more commands, or everything you type after running the script will also be echoed.