Accessing the CLI Script Environment

Use the following procedure to access the CLI script environment.
  1. In the CLI, enter the script environment using the script command:
    hostname:> script
    ("." to run)>
  2. At the script environment prompt, you can input your script, finally entering a period character (.) alone on a line to execute the script:
    hostname:> 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:
    hostname:> script print("It is now " + new Date())
    It is now Tue Oct 11 2022 05:33:01 GMT+0000 (UTC)