Previous Next Chapter

RESIDENT

Displays and modifies the list of resident commands.

Format

RESIDENT [<resident name>] [<filename>] [REMOVE] [ADD] [REPLACE] [PURE | FORCE] [SYSTEM]

Template

NAME,FILE,REMOVE/S,ADD/S,REPLACE/S,PURE=FORCE/S,SYSTEM/S

Location

Internal

RESIDENT loads a command into memory and adds it to the resident list maintained by the Shell. This allows the command to be executed without reloading it from disk each time. If RESIDENT is invoked with no options, it lists the programs on the resident list.

To be made resident, a command should be pure, meaning that it is both re-entrant and re-executable. A re-entrant command can properly support independent use by two or more programs at the same time. A re-executable command dies not have to be reloaded to be executed again. Commands that have these characteristics are called pure and have the p (pure) protection bit set.

The following commands cannot be made resident: BINDDRIVERS, CONCLIP, IPREFS, LOADRESOURCE, LOADWB, and SETPATCH.

LIST the C: directory to check for the presence of the p protection bit to determine which commands are pure.

Many of the commands in the C: directory, as well as the MORE command in Utilities, are pure commands and can be made resident. If a command does not have its pure bit set, it probably cannot be made resident safely. (Setting the pure bit does not make a command or program pure.)

The REPLACE option is the default option and does not need to be explicitly stated. If no <resident name> is specified (for example, only a file name is specified), RESIDENT uses the file name portion as the name on the resident list. The full path to the file must be used.

If a <resident name> is specified and RESIDENT finds a program with that name already on the list, it attempts to replace the command. That <resident name> must be used to reference the resident version of the command. The replacement succeeds only if the already-resident command is not in use.

To override REPLACEment and make several versions of a command resident simultaneously, use the ADD option, giving a different <resident name> for each version loaded.

If the System option is specified, the command is added to the system portion of the resident list and becomes available as a system component. Any commands added to the resident list with the SYSTEM option cannot be removed. To list these files on the RESIDENT list, you must specify the SYSTEM option.

The PURE option forces RESIDENT to load commands that are not marked as pure and use them to test the pureness of other commands and programs. Use the PURE option with caution. Be sure the programs that you make RESIDENT meet the criteria to be resident or be careful to use the command in only one process at a time.

The availability of internal commands can also be controlled with RESIDENT. To deactivate an Internal command (for example, if an application has its own command of the same name), use RESIDENT <command> REMOVE. The command can be reactivated with the REPLACE option.

Example 1:

1> RESIDENT C:COPY

makes the COPY command resident (replaces any previous version).

Example 2:

1> RESIDENT Copy2 DF1:C/COPY ADD

adds another version of COPY to the resident list, under the name Copy2.

Example 3:

1> RESIDENT Xdir DF1:C/Xdir PURE

makes an experimental, non-pure version of the DIR command resident.

Example 4:

1> RESIDENT CD REMOVE

makes the Internal CD command unavailable.

Example 5:

1> RESIDENT CD REPLACE

restores the CD command to the system.

See also: PROTECT, LIST.

RUN

Executes commands as background processes.

Format

RUN <command...> [{+ <command>}]

Template

COMMAND/F

Location

Internal

RUN is used to start background processes. A background process does not open its own window for input or output and does not take over the parent Shell.

RUN attempts to execute the <command> and any arguments entered on the command line. You can RUN multiple command lines by separating them with plus signs (+). If you press Return after a plus sign, RUN interprets the next line as a continuation of the same command line.

To make it possible to close the Shell window in which the process was started, redirect the output of RUN with RUN >NIL: <command>.

A new background Shell has the same search path and command stack size as the Shell from which RUN is given.

You can RUN commands stored to the resident list. Resident commands are checked before commands in the command path. A Shell started with RUN NEWSHELL uses the default startup file, S:Shell-startup.

Example 1:

1> RUN COPY Text TO PRT:+
DELETE Text +
ECHO "Printing finished"

prints the Text file by copying it to the printer device, deletes it, then displays the given message. Plus signs string together the command lines, causing each command to be run after the previous command finishes.

Example 2:

1> RUN EXECUTE Comseq

executes, in the background, all the commands in the script file Comseq.

For more examples using the RUN command, see Chapter 8.

SEARCH

Looks for the specified text string in the files of the specified directories.

Format

SEARCH [FROM] {<name | pattern>} [SEARCH] <string | pattern> [ALL] [NONUM] [QUIET] [QUICK] [FILE] [PATTERN]

Template

FROM/M,SEARCH/A,ALL/S,NONUM/S,QUIET/S,QUICK/S,FILE/S,PATTERN/S

Location

C:

SEARCH looks through all the files in the FROM directory for the string given in the SEARCH string. (The FROM and SEARCH keywords are optional.) If the ALL switch is given, SEARCH also looks through all the subdirectories of the FROM directory. SEARCH displays the name of the file being searched and any line that contains the text sought. You must place quotation marks around any search text containing a space. The search is not case-sensitive.

The options are:

NONUM

Line numbers are not printed with the strings.

QUIET

Searches quietly; file names being searched are not displayed.

QUICK

Use a more compact output format.

FILE

Looks for a file by the specified name, rather than for a string in the file.

PATTERN

Uses pattern matching to search for the string.

SEARCH leaves a 0 in the condition flag if the object is found, and a 5 (WARN) otherwise. To abandon the search of the current file and continue to the next file, if any, press Ctrl+D. SEARCH is aborted when Ctrl+C is pressed.

Examples

1> SEARCH DEVS: DOSDrivers globvec
DOSDrivers (dir)
PIPE..
6 GlobVec =-1
PIPE.info

1> SEARCH utilities #?.info FILE
Workbench:Utilities/Clock.info
Workbench:Utilities/MultiView.info

SET

Sets a local vaiable.

Format

SET [<name>] [<string...>]

Template

NAME,STRING/F

Location

Internal

SET with no arguments lists the current local variables.

SET with <name> and <string> arguments creates a new environment variable. The first word after SET is taken as the <name>. Everything else on the command line is taken as the <string> argument. Quotation marks are not required.

An environment variable created with SET is local to the Shell in which it was created. If you create a new Shell with the NEWSHELL command, that Shell also recognizes any variables created in its parent Shell. However, if you create a new Shell with the Execute Command Workbench menu item or by opening the Shell icon, variables created with SET are not recognized in the new Shells.

You can call environment variables in a script or on a command line by placing a dollar sign ($) in front of the variable name.

To remove a local variable definition, use the UNSET command.

Examples:

1> SET Origin This process launched from icon

creates the local variable Origin that sores a reminder that a Shell was invoked from an icon rather than a NEWSHELL.

1> ECHO $Origin
This process launched from icon

See also: GET, UNSET

Top Previous Next Chapter