set
command
Sets a local variable.
See also: setenv
Usages
-
set [-g] name = value -
set -u name -
set -p name = value -
set [-s]
Without any arguments, the command prints a list of current local variables (see the -s option).
Options
|
|
Make the variable global. |
|
|
Unset the variable. |
|
|
Set the variable in the calling (parent) script. This option lets you return values from within sourced scripts, by directly setting a variable in the caller. |
|
|
Without any other arguments, prints the current variables in the form of commands. |
Examples
set num = 1234 echo $num
Prints 1234.
set nodes = `run("ls")`
Sets $nodes to the result of the ls command.