Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ StartupShell(8) — A/UX 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dp(1M)

pname(1M)

bzb(4)

dpme(4)

environ(5)

gd(7)

autorecovery(8)

launch(8)




StartupShell(8) StartupShell(8)
NAME StartupShell - a command interpreter accessible from within the A/UX Startup application SYNOPSIS StartupShell DESCRIPTION A/UX Startup is a Macintosh(Reg.) program that can read and execute programs that have been compiled with a special set of libraries under the A/UX(Reg.) operating system. A/UX Startup provides a command language that executes commands typed at the console or chosen from menus. The language is similar to but simpler than sh(1), csh(1), and ksh(1). Pro- grams run by this shell must reside in a Macintosh file sys- tem. Input Keyboard input and program output is displayed in a per- manently displayed window-the shell window. A subset of the ordinary A/UX terminal interface is supported; specifically, the erase, kill, end-of-file, and end-of-line signals; input flags for remapping characters; output flags not associated with delays; and local flags not associated with signals. The control flags are not supported. The end-of-line char- acter should not be changed. The following characters have a special meaning to the shell and help delimit words unless escaped: < > = newline space tab To suppress their special interpretation, precede any of these characters with a backslash (\). This process is also called an escape, and the backslash is called an escape character when used for this purpose. An escaped newline is treated the same as a blank character. All special charac- ters enclosed between a pair of single quotation marks (''), except another single quotation marks, are treated as if they were escaped. Most special characters enclosed within double quotation marks ("") are treated as if they were es- caped, except the backslash (\), comma (,), and dollar sign ($). Each line of input is considered to be a single command. A command is broken into words at blanks (a blank is a space or a tab) except when the blanks are escaped. Text enclosed within double quotation marks that contains references to variables is processed so that variables are replaced by their present values. References to variables enclosed within single quotation marks are not replaced with April, 1990 1



StartupShell(8) StartupShell(8)
their present value. A backslash (\) in the first word of a command causes au- tomatic substitution to be disabled for that command. The A/UX Startup shell prompts with the value of the PS1 variable before reading a command. Shell Variables The shell allows certain words to be used as variables. The name of a variable is a sequence of letters, digits, or un- derscores beginning with a letter or underscore. The excep- tion is the exit status variable (?). Variables may be assigned values by entering: name=value where value is a single word, or by entering: name="multiple-word-value" where multiple-word-value is several words. A dollar sign ($) followed by a variable name is substituted with the present value of a variable. Alternately, you can enclose the variable name in curly braces: ${name} The braces are required only when the name is followed by a letter, digit, or underscore that is not part of the vari- able name. After variable substitution, the results of sub- stitution are scanned for internal field separator charac- ters (space and tab) and split into distinct arguments where such characters are found. Explicit null arguments ("" or '') are retained. Implicit null arguments (those resulting from variables that have no values) are removed. A text string may be intrepreted as a variable name without the dollar sign (or braces) if it is the first word of a command line and it is the name of an ``automatic'' vari- able. Each time a command line is entered, the first word is checked for matches with any of automatic variables already defined. If there is a match then the value is substituted. The process is not repeated on the replacement. Whereas normal variables are created when they are assigned values, automatic variables must be declared as such (see auto in the section ``Built-in Commands''). The variables autorecovery and autolaunch are examples of automatic vari- ables. 2 April, 1990



StartupShell(8) StartupShell(8)
The following variables are built into the A/UX Startup shell: PATH Specify the search path for commands (see the section ``Program Execution Environment'' below). PS1 Specify the prompt string, by default ``start- up# .'' TZ Specify the A/UX time-zone variable (see en- viron(5)). HOME Specify the default argument (home directory) for the cd and chdir commands. ROOT Specify the default argument (home root) for the chroot command. autorecovery Specify the command string for verifying the in- tegrity of the file system. autolaunch Specify the command string for the kernel launch program (see below). cwd Specify the current working directory of the shell. cwroot Specify the current working root of the shell. ? Specify the exit status returned by the last command executed. The shell gives initial values to all the above variables. The values persist across invocations of A/UX Startup even if the variable is not exported (see export in the section ``Built-in Commands''). There is a limit on the number of variables that can exist. The limit is normally 20, but can be changed by modifying a resource. Program Execution Environment The shell interprets each line of input as a single command. The first word in the command line is interpreted as the name of the command to be executed. If a command name matches one of the special commands built into the shell (see the section ``Built-in Commands''), it is executed in the shell process. If the command name does not match a special command, a search for a program of the same name occurs in the search paths stored in the PATH variable. April, 1990 3



StartupShell(8) StartupShell(8)
The command name is passed as argument 0 to the executing program. Most of the words following the first word in the command line are passed as arguments to the program invoked. The exceptions are words in positions that are subject to special interpretation because of nearby special characters (see the preceding section ``Input''). You can define multiple search paths within the PATH vari- able by separating them with a vertical bar (|). The de- fault search path is (mac):|(mac):bin: This specifies the same folder as A/UX Startup and a Macin- tosh folder bin, within the same folder as startup, in that order. If you enter a command that includes a pathname, as signi- fied by a leading / or (, the search paths in PATH are not used. Otherwise, each directory in the search paths is searched for an executable file. The current ``environment'' (see environ(5)) is also passed to each program when invoked. The environment consists of a list of variable names and variable values. The shell main- tains the environment in several ways. On invocation, the shell reads the environment from a Macintosh resource. Us- ing the built-in commands, you can modify the values of any of these variables or create new variables. Unless variables are exported (or re-exported) with export, neither their names nor their current values are placed in the environ- ment. Once a variable has been placed in the environment, you can use the unexport or unset, command to remove it. The environment used by an executing program is thus com- posed of any unmodified name-value pairs originally read by the shell, minus any pairs removed by unexport and unset, plus any new assignments (or reassignments) that have been added through export commands. Redirection The input and the output of a command may be redirected (de- tached from the console) using specially interpreted charac- ters. The process is called redirection and the special characters are called redirection symbols when used for this purpose. Redirection symbols can also introduce the names of files that are used as the source of input or the desti- nation of output. These redirection symbols and their asso- ciated filenames are not passed as arguments to the invoked program. Each of the constructions affects processing as described in the following list: 4 April, 1990



StartupShell(8) StartupShell(8)
<word Use file word as standard input (file descriptor 0). >word Use file word as standard output (file descriptor 1). If the file does not exist, it is created; otherwise, it is truncated to a length of 0. >>word Use file word as standard output. If the file ex- ists, output is appended to it (by first seeking to the end-of-file); otherwise, the file is creat- ed. <&digit Use the file associated with file descriptor digit as standard input. Similarly, >&digit uses the file associated with the file descriptor digit as the standard output. <&- The standard input is closed. Similarly, standard output is closed by using >&-. If any of the above are preceded by a digit, the file descriptor is specified by the digit (instead of the default 0 or 1). For example: ...2>&1 associates file descriptor 2 with the file currently associ- ated with file descriptor 1. The order in which redirections are specified is signifi- cant. The shell evaluates redirections from left to right. For example, ... 1>word 2>&1 first associates file descriptor 1 with file word. It asso- ciates file descriptor 2 with the file associated with file descriptor 1 (word). If the order of redirections were re- versed, file descriptor 2 would be associated with the ter- minal (assuming file descriptor 1 had been) and file descriptor 1 would be associated with file word. The environment passed to an executing program contains the same file descriptors as the shell, except those modified by input and output redirections on the command line. Built-in Commands Built-in commands do not invoke corresponding programs that reside in a file system. Rather, the shell interprets such commands and their arguments all by itself. For these built-in commands, input and output redirection is permit- ted. Without redirection, the console is the default output April, 1990 5



StartupShell(8) StartupShell(8)
location for standard output and error output. More pre- cisely, file descriptor 1 is the default output location, and error output is permanently directed to the console, bypassing stderr (file descriptor 2). auto [ name] Set each of the named variables to be automatic. When entered at the start of a command line, the name of the automatic variable is replaced with its value. To avoid substitution when entering the name of an au- tomatic variable at the start of a command line, pre- cede (escape) the first word with a backslash (\). If entered without any arguments, auto displays a list of all automatic variables and their values. autolaunch [arg]... Execute the command string that has been assigned to the autolaunch variable. It cannot be unset or con- verted into a normal variable, so it consistently behaves like a built-in function. When entered, auto- launch executes whatever has been assigned to it. The assignment autolaunch=launch causes the startup program named launch(8) to be executed when autolaunch is en- tered. autorecovery [arg...] Executes the command string that has been assigned to the autorecovery variable. It cannot be unset or con- verted into a normal variable, so it consistently behaves like a built-in function. When entered, au- torecovery executes whatever has been assigned to it. boot Execute the autorecovery and autolaunch command strings. If the autorecovery command string fails (? is set to a nonzero exit value), autolaunch is not started. This command hides the shell window and shows you a progress bar dialog box. cd [path] chdir [path] Change the current directory to that specified by path. If no argument is specified, the value of HOME is used as the specification for path. chroot [path] Change the current root to that specified by path. If no argument is specified, the value of ROOT is used as the specification for path. default Display the default SCSI ID which contains (SCSI ID, 0, 0). 6 April, 1990



StartupShell(8) StartupShell(8)
echo [args] Display args after (unescaped) command and variable substiutions take place. eject [drive] Eject the disk in the enumerated disk drive. The drive number is either 0 or 1. exit Quit A/UX Startup. (Same as choosing the Quit from the File menu.) export [names] Export each of the named variables so that the variable and its present value become a part of the program exe- cution environment. The present value is saved between invocations of startup. If no names are specified, ex- port lists all exported variables along with their present values. help [command] Display the help associated with command. powerdown Shut the system power off (same as choosing the Shut Down item from the Execute menu). pwd Print the current working directory, which is also the value of the variable cwd. readonly [names] Set each of the named variables to be read-only. Read-only variables can't be reset through reassign- ments. However, the variable can be unset and then redefined. If no names are specified, readonly displays all the read-only variables along with their values. restart Restart the system (same as choosing the Restart item from the Execute menu). set Display all variables and their values. shutdown Shut down the machine (same as the choosing the Shut Down item from the Execute menu). unauto [names] Remove the automatic attribute from each of the named variables. unexport [names] April, 1990 7



StartupShell(8) StartupShell(8)
Remove the export attribute from each of the named variables. unset [names] Remove each of the named variables. None of the built-in shell variables can be unset. Menus What follows are descriptions of the effect of each menu item. If the menu item presents a dialog box, then each field of the dialog box is also described. Apple Menu About A/UX Startup... Display a window with some information about A/UX Startup, including the use of the help function to ob- tain help information. Help Print the default help message in the shell window. The message contains enough information for users to get more help by using the help function. Desk Accessories Display a menu of the desk accessories currently in- stalled on the system file located in the Macintosh file system from which the system was started. (Desk accessories stored in an A/UX file system won't be available until A/UX is running.) File Menu Close Close the currently active window. However, the shell window cannot be closed. Quit Quit A/UX Startup (same as the exit command). Edit Menu Undo Cut Copy Paste Clear Except for Copy, these menu items are present only for use with desk accessories. The shell window only al- lows Copy, when a range of text is selected. Execute Menu Boot Perform the autorecovery and autolaunch command strings (same as the boot command). AutoRecovery Perform the command string that has been assigned to 8 April, 1990



StartupShell(8) StartupShell(8)
autorecovery. Identical to the autorecovery command with no arguments. AutoLaunch Perform the command string that has been assigned to autolaunch. (same as the autolaunch command with no arguments except that the progress bar dialog box is shown). Kill Halt the currently running startup application. COMMAND-PERIOD and COMMAND-K are keyboard shortcuts for this. Restart Restart the machine (same as the restart command). Shut Down Shut the system off (same as the shutdown command). Preferences Menu Booting ... Present a dialog box that allows you to set various startup parameters associated with the boot command (and the Boot menu item in the Execute menu). Eject disks on Launch When this check box is checked, all floppy disks are automatically ejected at the time the A/UX kernel is launched. This value is stored in a Macintosh resource. Automatically Boot at startup When this check box is checked, the shell automatically runs the boot command when launched, causing the A/UX kernel to boot as a part of the launching of A/UX Startup. This value is stored in a Macintosh resource. AutoRecovery Command This text box displays the value of the built-in autorecovery variable. This value can be changed by selecting the text box and editing it. AutoLaunch Command This field displays the value of the built in auto- launch variable. The value can be changed by selecting this text box and editing the text displayed. General ... Present a dialog box containing miscellaneous items the user may want to change. RootDirectory April, 1990 9



StartupShell(8) StartupShell(8)
This text box displays the value of the built-in ROOT variable. The value can be changed by selecting the text and editing it. Home Directory This text box displays the value of the built-in HOME variable. The value can be changed by selecting the text and editing it. Cluster Number This text box displays the value of the autorecovery cluster number. Refer to autorecovery(8) for an expla- nation of what this number does. The value is stored in nonvolatile RAM (see nvram(7)). Devices, Partitions, and Pathnames In the A/UX environment, you access multiple file systems by mounting file systems (block device files) on accessible directories. The A/UX Startup environment does not support mount. Instead, the A/UX pathname syntax has been extended with an optional prefixed device specification. A device specification has either the form (S,D,P); where S, D, and P are integers identifying a SCSI ID, disk (or logical unit), and partition respectively, or the special prefix ``(de- fault).'' The prefix (default) refers to the disk contain- ing the version of A/UX Startup that is currently running. When no device specification is used, the path is integrated relative to the current directory or current root (as the path is relative or absolute). chroot always changes the current directory to be the new root. Character and block device files are not supported, because they depend on a mapping between device major numbers and devices, which is specific to the A/UX kernel. However, with respect to the following special files, the open system call (see open(2)) does cause fake device files to be opened in raw (character) mode, but their inodes are outside the normal file system space. All other device files cannot be opened from the A/UX Startup environment. These device files are: /dev/console /dev/syscon /dev/systty /dev/dsk/cSdDsP /dev/rdsk/cSdDsP /dev/null /dev/floppy[0,1] /dev/rfloppy[0,1] 10 April, 1990



StartupShell(8) StartupShell(8)
where S, D, and P are integers corresponding to those in a device specification (SCSI ID, device zero, and slice number, respectively). Disk partitions are assigned slice number. The slice numbers are restricted to the range 0-31. Essentially the slice numbers act as a user-controlled cache of partitions. Three partitions are assigned slice numbers automatically: the root partition to 0, the swap partition to 1, and the usr partition to 2. The way root, swap, and usr partitions are recognized depends on the autorecovery cluster number and the block 0 blocks (bzb) in the disk-partition-map en- tries (dpme). Slice number 31 always refers to the entire disk. You may also explicitly associate partitions and slice numbers by using pname. See gd(7), autorecovery(8), dpme(4), bzb(4), and pname(1M) for more details. The following is an example of a device specification and pathname: (1,0,2)/include/sys/param.h This denotes the file param.h in the directory /sys that is in the directory /include that is in the root directory of the file system located in the partition associated with slice 2 of the device with SCSI ID 1. Programs The following programs have been converted to run under the A/UX Startup shell: cat Concatenate and print files. chgrp Change the group. chmod Change the mode. chown Change the owner. cp Copy files. cpio Copy file archives in and out. date Print and set the date.. dd Convert and copy a file. dp Perform disk partitioning. ed Edit text. esch Run the autorecovery program. fsck Check and interactively repair the file sys- tem. fsdb Debug a SVFS or a UFS file system. kconfig Change a kernel's variables for tuning. launch Launch an A/UX kernel. ln Make links. ls List the contents of directory. mkdir Make directories. mkfs Construct a System V file system. mknod Build a device file. mv Move or rename files. April, 1990 11



StartupShell(8) StartupShell(8)
newfs Construct a UFS file system. od Perform an octal dump. pname Associate named partitions with device nodes. read-disk Simplified disk reader for install. rm Remove files or directories. stty Set the options for a terminal. tar File archiver. Except for launch, esch, and read-disk, each command is an A/UX command rewritten for the A/UX Startup shell environ- ment. For more information about the basically equivalent commands, refer to the other sections of this manual and Section 1 of the A/UX Command Reference. Variables None of the built-in variables may be unset or have their attributes changed. Between invocations of A/UX Startup, any reassignments made for built-in variables will persist. Name Attribute Default Comment Value ? 0 Not assignable autorecovery auto echo no autorecovery cwd / Not assignable cwroot (default)/ Not assignable HOME export / autolaunch auto launch PATH export (mac)s|(mac):bin: PS1 startup# ROOT export (default)/ TZ export PST8PDT Macintosh Resources There are several resources in the resource fork of A/UX Startup that may be of interest. All nonstandard resources have associated ResEdit template (TMPL) resources so that they can be edited. One should not edit anything other than the STRL/config resource and the SASH/variables resource. (SASH stands for Startup Application Shell.) 12 April, 1990



StartupShell(8) StartupShell(8)
Name Type ID Description version SASH 0 A standard version string. state SASH 1 Miscellaneous state variables, use SASH template. variables SASH 2 Saved variables, exported and built-in, use VARL template. help SASH 3 All the help text, use WSTR template. * ERRL * Connects internal error numbers to problem description and action strings, use ERRL tem- plate. * STRL * Lists of strings identified by numeric tags, use STRL template. config STRL 134 A list of strings which are in the following ord- er: font name, font size, maximum number of vari- ables, and kilobytes of memory for running start- up programs. WARNINGS When using this shell, you are effectively running as su- peruser, so there is no permission checking. Everything is accessible and very few actions are disallowed. BUGS The fake character device files (/dev/rxxxx) are a bad idea and should be changed. Being required to attach partitions to slices is also bad. Backspacing over tab characters looks wrong on the screen. Running the ls command on /dev reports erroneous information for the device files mentioned above. However, you can see the correct information by prefixing a device specification to the directory. SEE ALSO dp(1M), pname(1M), bzb(4), dpme(4), environ(5), gd(7), autorecovery(8), launch(8). A/UX Command Reference. April, 1990 13

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026