Using the Get Function
The run
function is sufficiently powerful that it may be tempting to rely exclusively on parsing output to get information about the system, but this has the decided disadvantage that it leaves scripts parsing human-readable output that may or may not change in the future. To more robustly gather information about the system, use the built-in get
function. In the case of the boot_time
property, this will return not the string but rather the ECMAScript Date
object, allowing the property value to be manipulated programmatically. For more reliable scriptable values, see Using the Prop Function.