cl: Execute commands from the standard input

Package: language

Parameters

gcur = ""
Global graphics cursor.
imcur = ""
Global image cursor.
abbreviate = yes
Permits minimum match abbreviations of task and parameter names (disabled within scripts).
echo = no
Echo all commands received by the CL on the terminal.
ehinit = "standout eol noverify"
Ehistory options string. (See "ehistory")
epinit = "standout noshowall"
Eparam options string. (See "eparam")
keeplog = no
Keep a log of all CL commands.
logfile = "uparm$logfile"
The name of the logfile, if command logging is enabled.
logmode = "commands nobackground noerrors notrace"
Logging mode control parameter. (See "logging")
lexmodes = yes
Enable automatic mode switching between "command mode" (used when commands are being entered interactively at the terminal), and "compute mode" (used to evaluate arithmetic expressions and argument lists). If lexmodes is disabled command mode is disabled. Command mode is always disabled within scripts and within parenthesis, i.e., expressions or formal argument lists.
mode = "ql"
The parameter mode of the CL, and of any tasks run by the CL which do not specify their own mode (i.e., which specify `auto' mode). A "q" causes a query to be generated whenever a parameter is used which was not set explicitly on the command line. An "m" (menu mode) causes eparam to be called to edit/check a task's parameters when the task is run interactively. An "l" causes the parameter file for a task to be updated on disk whenever the task is run interactively. Note that changing the mode at the CL level will have no affect on the operation of an individual task unless "auto" mode is set at the package, task, and parameter level, causing the mode to defer to the global CL mode.
notify = yes
If notify is enabled background jobs will print a message on the user terminal (or in the logfile for a queued job) notifying the user when the job completes.
szprcache = (a small number)
Controls the size of the process cache. The value may range from 1 to 10. A larger number reduces process spawns but the idle processes may consume critical system/job resources.

Description

The cl and clbye commands are used to call the CL as a task. The function of the cl task is to read and execute commands from its standard input until bye or end of file is reached. The cl task may be called with arguments or executed in the background like any other task. The cl task may be called from within a procedure or script to read commands from the command stream which called that procedure or task; this is usually the terminal but may be a another script.

When the cl or clbye command is invoked, the command language interpreter stores information about which tasks and packages are currently defined. When the command is finished any tasks or packages which have become defined since invocation are lost, unless the user specifically overrides this by using the keep command.

The clbye command performs exactly like a cl followed by a bye, except that when called from a script the script file is closed immediately, freeing its file descriptor for use elsewhere. If cl is used instead of clbye in a script, the file is not closed until after the cl returns. If a clbye is used in a script, any commands following the clbye will not be executed.

Examples

1. Execute CL commands from a file.

cl> cl < cmdfile

2. Execute CL commands from a pipe.

cl> print ("!type ", fname) | cl

3. Execute cl, taking command input from the terminal. Since command input is already from the terminal, the only effect is to mark the state of CL memory, to allow task, set, and other definitions to be made temporarily and later freed by terminating the cl with a bye.

cl> cl
cl> set pak = "home$tasks/"
cl> task $mytask = pak$x_mytask.e
        (execute the task)
cl> bye

In the example above, the declarations of the logical directory "pak" and the task "mytask" are discarded when the bye is entered, terminating the cl.

Bugs

Beware that any changes made to the global CL parameters during the execution of a cl remain in effect after the task terminates.

See also

bye, keep, logout