Home Reference HScript commands 

set hscript command

Sets a local variable.

Usages

  1. set [-g] name = value

  2. set -u name

  3. set -p name = value

  4. set [-s]

Without any arguments, the command prints a list of current local variables (see the -s option).

Options

-g

Make the variable global.

-u

Unset the variable.

-p

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.

-s

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.