Understanding The Built-In Cli Functions - Oracle ZFS Storage Appliance Administration Manual

Hide thumbs Also See for ZFS Storage Appliance:
Table of Contents

Advertisement

dory:> script
("." to run)>
2.
At the script environment prompt, you can input your script, finally entering "."
alone on a line to execute it:
dory:> script
("." to run)> for (i = 10; i > 0; i--)
("." to run)>
printf("%d... ", i);
("." to run)> printf("Blastoff!\n");
("." to run)> .
10... 9... 8... 7... 6... 5... 4... 3... 2... 1... Blastoff!
3.
If your script is a single line, you can simply provide it as an argument to the
script command, making for an easy way to explore scripting:
dory:> script print("It is now " + new Date())
It is now Tue Oct 14 2009 05:33:01 GMT+0000 (UTC)

Understanding the Built-in CLI Functions

Of course, scripts are of little utility unless they can interact with the system at large. There are
several built-in functions that allow your scripts to interact with the system:
TABLE 9
Built-in Functions to Support System Interactions
Function
get
list
run
props
set
choicies
Accessing the CLI Script Environment
Description
Gets the value of the specified property. Note that this
function returns the value in native form, e.g. dates are
returned as Date objects.
Returns an array of tokens corresponding to the dynamic
children of the current context.
Runs the specified command in the shell, returning
any output as a string. Note that if the output contains
multiple lines, the returned string will contain embedded
newlines.
Returns an array of the property names for the current
node.
Takes two string arguments, setting the specified
property to the specified value.
Returns an array of the valid property values for any
property for which the set of values is known and
enumerable.
About the Oracle ZFS Storage Appliance
45

Advertisement

Table of Contents
loading

Table of Contents