Using the Choices Function
set('pool', pools[p]);
projects = list();
for (i = 0; i < projects.length; i++) {
run('select ' + projects[i]);
shares = list();
for (j = 0; j < shares.length; j++) {
run('select ' + shares[j]);
share = pools[p] + ':' + projects[i] + '/' + shares[j];
printf(fmt, share, get('space_data'),
get('space_available'));
run('cd ..');
}
run('cd ..');
}
}
2.
Here is the output of running the script:
SHARE USED AVAILABLE
pond:projectA/fs1 31744 566196178944
pond:projectA/fs2 31744 566196178944
pond:projectB/lun1 21474836480 587670999040
puddle:deptA/share1 238475 467539219283
puddle:deptB/share1 129564 467539219283
puddle:deptB/share2 19283747 467539219283
Using the Functions for Generating Output
Reporting state on the system requires generating output. Scripts have several built-in functions
made available to them to generate output:
TABLE 10
Built-in Functions for Generating Output
Function Description
dump
Dumps the specified argument to the terminal, without
expanding embedded newlines. Objects will be displayed
in a JSON-like format. Useful for debugging.
print
Prints the specified object as a string, followed by a
newline. If the object does not have a toString method,
it will be printed opaquely.
printf
Like C's printf(3C), prints the specified arguments
according to the specified formatting string.
52 Oracle ZFS Storage Appliance Administration Guide, Release OS8.6.x • September 2016