Using the Run Function

  1. The simplest way for scripts to interact with the larger system is to use the run function. The run function takes a command to run, and returns the output of that command as a string. For example:
    hostname:> configuration version script dump(run('get boot_time'))
    '                     boot_time = 2022-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 previous example based on whitespace (negative space):
    hostname:> configuration version script dump(run('get boot_time').split(/\s+/))
    ['', 'boot_time', '=', '2022-10-12', '07:02:17', '']