Go to main content
Oracle® ZFS Storage Appliance Administration Guide, Release OS8.7.0

Exit Print View

Updated: July 2017
 
 

Using the Run Function

  1. The simplest way for scripts to interact with the larger system is to use the "run" function: it takes a command to run, and returns the output of that command as a string. For example:
    dory:> configuration version script dump(run('get boot_time'))
    '                     boot_time = 2009-10-12 07:02:17\n'
  2. The built-in dump function dumps the argument out, without expanding any embedded newlines. ECMAScript's string handling facilities can be used to take apart output. For example, splitting the above based on whitespace:
    dory:> configuration version script dump(run('get boot_time').split(/\s+/))
    ['', 'boot_time', '=', '2009-10-12', '07:02:17', '']