annotate docs/nitros9guide/chap4.chapter @ 1515:30c1d42f3913

Added comments, slow optimization progress
author boisy
date Thu, 22 Jan 2004 18:42:14 +0000
parents b00cf13c9f61
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1 <chapter>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
2 <title>Advanced Features of the Shell</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
3 <para>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
4 The basic shell functions were introduced in a prior chapter in order
1500
b00cf13c9f61 Major changes for new NitrOS-9 manual
boisy
parents: 1094
diff changeset
5 to provide an understanding of how basic NitrOS-9 commands work. In
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
6 this section the more advanced capabilities of the shell are
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
7 discussed. In addition to basic command line processing, the shell
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
8 has functions that facilitate:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
9 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
10
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
11 <itemizedlist mark="square">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
12 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
13 I/O redirection (including filters)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
14 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
15 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
16 Memory Allocation
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
17 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
18 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
19 Multitasking (concurrent execution)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
20 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
21 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
22 Procedure File Execution (background processing)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
23 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
24 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
25 Execution Control (built-in commands)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
26 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
27 </itemizedlist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
28
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
29 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
30 There is a virtually unlimited combination of ways these
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
31 capabilities can be used, and it is impossible to give more than a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
32 representative set of examples in this manual. You are therefore
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
33 encouraged to study the basic rules, use your imagination, and
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
34 explore the possibilities on your own.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
35 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
36
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
37 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
38 <title>A More Detailed Description Command Line Processing</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
39 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
40 The shell is a program that reads and processes command lines one
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
41 at a time from its input path (usually your keyboard). Each line is
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
42 first scanned (or &quot;parsed&quot;) in order to identify and process any of
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
43 the following parts which may be present:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
44 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
45
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
46 <itemizedlist mark="square">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
47 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
48 A program, procedure file, or built-in command name (&quot;verbs&quot;)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
49 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
50 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
51 Parameters to be passed to the program
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
52 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
53 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
54 Execution modifiers to be processed by the shell
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
55 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
56 </itemizedlist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
57
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
58 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
59 Note that only the verb (the program or command name) need be
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
60 present, the other parts are optional. After the verb has been
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
61 identified, the shell processes modifiers (if any). Any other text
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
62 not yet processed is assumed to be parameters and passed to the program called.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
63 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
64 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
65 Unless the verb is a &quot;built-in command&quot;, the shell will run the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
66 program named as a new process (task). It then deactivates itself
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
67 until the program called eventually terminates, at which time it
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
68 gets another input line, then the process is repeated. This happens
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
69 over and over until an end-of-file condition is detected on the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
70 shell's input path which causes the shell to terminate its own
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
71 execution.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
72 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
73 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
74 Here is a sample shell line which calls the assembler:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
75 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
76 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
77 asm sourcefile l -o &gt;/p #12k
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
78 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
79 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
80 In this example:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
81 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
82
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
83 <informaltable frame="none">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
84 <tgroup cols="2">
646
2e21fb7216af XMLified.
roug
parents: 144
diff changeset
85 <colspec colwidth="2in"/>
2e21fb7216af XMLified.
roug
parents: 144
diff changeset
86 <colspec colwidth="3in"/>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
87 <tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
88 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
89 <entry>asm</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
90 <entry>is the verb</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
91 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
92 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
93 <entry>sourcefile l -o</entry>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
94 <entry>are parameters passed to <command>asm</command></entry>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
95 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
96 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
97 <entry>&gt;/p</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
98 <entry>is a modifier which redirects the output
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
99 (listing) to the system's printer</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
100 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
101 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
102 <entry>#12K</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
103 <entry>is a modifier which requests that the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
104 process be assigned 12K bytes of memory
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
105 instead of its (smaller) default amount.</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
106 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
107 </tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
108 </tgroup>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
109 </informaltable>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
110
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
111 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
112 The verb must be the first name in the command line. After it
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
113 has been scanned, the shell first checks if it is a &quot;built-in&quot;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
114 command. If it is, it is immediately executed. Otherwise, the shell
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
115 assumes it is a program name and attempts to locate and execute it.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
116 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
117 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
118
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
119 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
120 <title>Execution Modifiers</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
121 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
122 Execution modifiers are processed by the shell before the program
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
123 is run. If an error is detected in any of the modifiers, the run
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
124 will be aborted and the error reported. Characters which comprise
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
125 modifiers are stripped from the part(s) of the command line passed
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
126 to the program as parameters, therefore, the characters reserved for
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
127 use as modifiers ( # ; ! &lt; &gt; &amp; ) cannot be used inside parameters,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
128 but can be used before or after the parameters.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
129 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
130
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
131 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
132 <title>Alternate Memory Size Modifier</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
133 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
134 When command programs are invoked by the shell, they are
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
135 allocated the minimum amount of working RAM memory specified in the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
136 program's module header. A module header is part of all executable
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
137 programs and holds the program's name, size, memory requirements,
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
138 etc. Sometimes it is desirable to increase this default
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
139 memory size. Memory can be assigned in 256-byte pages using the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
140 modifier &quot;#n&quot; where n is the decimal number of pages, or in 1024
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
141 byte increments using the modifier &quot;#nK&quot;. The two examples below
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
142 behave identically:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
143 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
144 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
145 OS9: copy #8 file1 file2 (gives 8*256 = 2048 bytes)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
146 OS9: copy #2K file1 file2 (gives 2*1024 = 2048 bytes)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
147 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
148 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
149
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
150 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
151 <title>I/O Redirection Modifiers</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
152 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
153 The second kind of modifier is used to redirect the program's
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
154 &quot;standard I/O paths&quot; to alternate files or devices. Well-written
1500
b00cf13c9f61 Major changes for new NitrOS-9 manual
boisy
parents: 1094
diff changeset
155 NitrOS-9 programs use these paths for routine I/O. Because the programs
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
156 do not use specific file or device names, it is fairly simple to
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
157 &quot;redirect&quot; the I/O to any file or device without altering the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
158 program itself. Programs which normally receive input from a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
159 terminal or send output to a terminal use one or more of the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
160 standard I/O paths as defined below:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
161 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
162 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
163 STANDARD INPUT: This path normally passes data from the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
164 terminal's keyboard to the program.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
165 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
166 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
167 STANDARD OUTPUT PATH: This path is normally used to output
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
168 data from the program to the terminal's display.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
169 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
170 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
171 STANDARD ERROR OUTPUT PATH: This path is used to output
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
172 routine status messages such as prompts and errors to the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
173 terminal's display (defaults to the same device as the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
174 standard output path). NOTE: The name &quot;error output&quot; is
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
175 sometimes misleading since many other kinds of messages besides
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
176 errors are sent on this path.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
177 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
178 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
179 When new processes are created, they inherit their parent process'
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
180 standard I/O paths. Therefore, when the shell
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
181 creates new processes, they usually inherit its standard I/O paths.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
182 When you log-on the shell's standard input is the terminal keyboard;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
183 the standard output and error output is the terminal's display.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
184 When a redirection modifier is used on a shell command line, the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
185 shell will open the corresponding paths and pass them to the new
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
186 process as its standard I/O paths. There are three redirection
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
187 modifiers as given below:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
188 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
189 <informaltable frame="none">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
190 <tgroup cols="2">
646
2e21fb7216af XMLified.
roug
parents: 144
diff changeset
191 <colspec colwidth="0.4in"/>
2e21fb7216af XMLified.
roug
parents: 144
diff changeset
192 <colspec colwidth="3in"/>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
193 <tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
194 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
195 <entry>&lt;</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
196 <entry>Redirect the standard input path</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
197 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
198 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
199 <entry>&gt;</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
200 <entry>Redirect the standard output path</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
201 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
202 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
203 <entry>&gt;&gt;</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
204 <entry>Redirect the standard error output path</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
205 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
206 </tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
207 </tgroup>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
208 </informaltable>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
209
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
210 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
211 When redirection modifiers are used on a command line, they must
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
212 be immediately followed by a pathlist describing the file or device
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
213 the I/O is to be redirected to or from. For example, the standard
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
214 output of <command>list</command> can be redirected to write to the system printer
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
215 instead of the terminal:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
216 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
217 <screen>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
218 OS9: list correspondence &gt;/p
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
219 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
220 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
221 Files referenced by I/O redirection modifiers are automatically
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
222 opened or created, and closed (as appropriate) by the shell. Here is
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
223 another example, the output of the <command>dir</command> command is redirected to the
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
224 file <filename>/D1/savelisting</filename>:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
225 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
226 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
227 OS9: DIR &gt;/D1/savelisting
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
228 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
229 <para>
1094
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
230 If the <command>list</command> command is used on the file <filename>/D1/savelisting</filename>, output
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
231 from the <command>dir</command> command will be displayed as shown below:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
232 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
233 <screen>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
234 OS9: list /d1/savelisting
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
235
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
236 Directory of . 10:15:00
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
237 myfile savelisting file1
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
238 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
239 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
240 Redirection modifiers can be used before and/or after the program's
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
241 parameters, but each modifier can only be used once.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
242 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
243 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
244 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
245
1093
4dae346c4969 Added crossreferences and lowercased synopsises
roug
parents: 1053
diff changeset
246 <section id="sec4.3">
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
247 <title>Command Separators</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
248 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
249 A single shell input line can request execution of more than one
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
250 program. These programs may be executed sequentially or
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
251 concurrently. Sequential execution means that one program must
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
252 complete its function and terminate before the next program is
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
253 allowed to begin execution. Concurrent execution means that several
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
254 programs are allowed to begin execution and run simultaneously.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
255
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
256 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
257
1093
4dae346c4969 Added crossreferences and lowercased synopsises
roug
parents: 1053
diff changeset
258 <section id="sec4.3.1">
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
259 <title>Sequential Execution</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
260 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
261 Programs are executed sequentially when each is entered on a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
262 separate line. More than one program can be specified on a single
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
263 shell command line by separating each
975
c565a4700689 The entitity replstart was replaced with <replaceable>
roug
parents: 646
diff changeset
264 <replaceable>program name</replaceable> <replaceable>parameters</replaceable>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
265 from the next one with a &quot;;&quot; character. For example:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
266 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
267 <screen>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
268 OS9: copy myfile /d1/newfile ; dir &gt;/p
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
269 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
270 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
271 This command line will first execute the <command>copy</command> command and then the
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
272 <command>dir</command> command.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
273 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
274 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
275 If an error is returned by any program, subsequent commands on
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
276 the same line are not executed (regardless of the state of the &quot;x&quot;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
277 option), otherwise, &quot;;&quot; and &quot;return&quot; are identical
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
278 separators.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
279 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
280 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
281 Here are some more examples:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
282 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
283 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
284 OS9: copy oldfile newfile; del oldfile; list newfile
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
285
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
286 OS9: dir &gt;/d1/myfile ; list temp &gt;/p; del temp
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
287 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
288 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
289 All programs executed sequentially are in fact separate, child
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
290 processes of the shell. After initiating execution of a
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
291 program to be executed sequentially, the shell enters the &quot;wait&quot;
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
292 state until execution of the called program terminates.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
293 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
294 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
295
1093
4dae346c4969 Added crossreferences and lowercased synopsises
roug
parents: 1053
diff changeset
296 <section id="sec4.3.2">
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
297 <title>Concurrent Execution</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
298 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
299 The second kind of separator is the &quot;&amp;&quot; which implies concurrent
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
300 execution, meaning that the program is run (as a separate, child
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
301 process), but the shell does not wait for it to complete
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
302 before processing the next command.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
303 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
304 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
305 The concurrent execution separator is therefore the means by
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
306 which multiprogramming (running two or more programs simultaneously)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
307 is accomplished. The number of programs that can run at the same
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
308 time is not fixed: it depends upon the amount of free memory in the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
309 system versus the memory requirements of the specific programs.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
310 Here is an example:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
311 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
312 <screen>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
313 OS9: dir &gt;/p&amp;
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
314 &amp;007
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
315
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
316 OS9:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
317 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
318 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
319 This command line will cause shell to start the <command>dir</command> command
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
320 executing, print the process ID number (&amp;007), and then immediately
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
321 display the &quot;OS9:&quot; prompt and wait for another command to be
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
322 entered. Meanwhile the <command>dir</command> command will be busy sending a directory
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
323 listing to the printer. You can display a &quot;status summary&quot; of all
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
324 processes you have created by using the <command>procs</command> command. Below is
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
325 another example:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
326 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
327 <screen>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
328 OS9: dir &gt;/p&amp; list file1&amp; copy file1 file2 ; del temp
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
329 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
330 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
331
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
332 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
333 <para>
1094
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
334 Because they were followed by &quot;&amp;&quot; separators, the <command>dir</command>,
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
335 <command>list</command>, and
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
336 <command>copy</command> programs will run concurrently,
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
337 but the <command>del</command> program will not
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
338 run until the <command>copy</command> program has terminated because sequential
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
339 execution (&quot;;&quot;) was specified.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
340 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
341 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
342
1093
4dae346c4969 Added crossreferences and lowercased synopsises
roug
parents: 1053
diff changeset
343 <section id="sec4.3.3">
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
344 <title>Pipes and Filters</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
345 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
346 The third kind of separator is the &quot;!&quot; character which is used to
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
347 construct &quot;pipelines&quot;. Pipelines consist of two or more concurrent
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
348 programs whose standard input and/or output paths connect to each
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
349 other using &quot;pipes&quot;.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
350 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
351 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
352 Pipes are the primary means-by which data is transferred from
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
353 process to process (interprocess communications). Pipes are first-in,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
354 first-out buffers that behave like mass-storage files.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
355 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
356 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
357 I/O transfers using pipes are automatically buffered and
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
358 synchronized. A single pipe may have several &quot;readers&quot; and several
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
359 &quot;writers&quot;. Multiple writers send, and multiple readers accept, data
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
360 to/from the pipe on a first-come, first-serve basis. An end-of-file
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
361 will occur if an attempt is made to read from a pipe but there are
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
362 no writers available to send data. Conversely, a write error will
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
363 occur if an attempt is made to write to a pipe having no readers.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
364 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
365 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
366 Pipelines are created by the shell when an input line having one
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
367 or more &quot;!&quot; separators is processed. For each &quot;!&quot;, the standard
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
368 output of the program named to the left of the &quot;!&quot; is redirected via
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
369 a pipe to the standard input of the program named to the right of
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
370 the &quot;!&quot;. Individual pipes are created for each &quot;!&quot; present.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
371 For example:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
372 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
373 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
374 OS9: update &lt;master_file ! sort ! write_report &gt;/p
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
375 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
376 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
377 In the example above, the program <command>update</command> has its input redirected
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
378 from a path called <filename>master_file</filename>. Its standard output becomes the
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
379 standard input for the program <command>sort</command>. Its output, in turn, becomes
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
380 the standard input for the program <command>write_report</command>, which has its
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
381 standard output redirected to the printer.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
382 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
383 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
384 All programs in a pipeline are executed concurrently. The pipes
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
385 automatically synchronize the programs so the output of one never
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
386 &quot;gets ahead&quot; of the input request of the next program in the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
387 pipeline. This implies that data cannot flow through a pipeline any
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
388 faster than the slowest program can process it. Some of the most
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
389 useful applications of pipelines are jobs like character set
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
390 conversion, print file formatting, data compression/decompression,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
391 etc. Programs which are designed to process data as components of a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
392 pipeline are often called &quot;filters&quot;.
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
393 The <command>tee</command> command, which uses
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
394 pipes to allow data to be simultaneously &quot;broadcast&quot; from a single
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
395 input path to several output paths, is a useful filter.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
396 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
397 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
398 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
399
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
400 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
401 <title>Command Grouping</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
402 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
403 Sections of shell input lines can be enclosed in parentheses
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
404 which permits modifiers and separators to be applied to an entire
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
405 set of programs. The shell processes them by calling itself
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
406 recursively (as a new process) to execute the enclosed program list.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
407 For example:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
408 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
409 OS9: (dir /d0; dir /d1) &gt;/p
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
410 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
411 gives the same result as:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
412 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
413 OS9: dir /d0 &gt;/p; dir /d1 &gt;/p
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
414 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
415 except for the subtle difference that the printer is &quot;kept&quot;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
416 continuously in the first example; in the second case another user
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
417 could &quot;steal&quot; the printer in between the <command>dir</command> commands.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
418 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
419 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
420 Command grouping can be used to cause a group of programs to be
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
421 executed sequentially, but also concurrently with respect to the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
422 shell that initiated them, such as:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
423 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
424 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
425 OS9: (del file1; del file2; del file3)&amp;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
426 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
427 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
428 A useful extension of this form is to construct pipelines consisting
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
429 of sequential and/or concurrent programs. For example:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
430 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
431 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
432 OS9: (dir CMDS; dir SYS) ! makeuppercase ! transmit
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
433 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
434 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
435 Here is a very practical example of the use of pipelines. Recall
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
436 that the <command>dsave</command> command generates a procedure file to copy all the
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
437 files in a directory. The example below shows how the output of
1500
b00cf13c9f61 Major changes for new NitrOS-9 manual
boisy
parents: 1094
diff changeset
438 <command>dsave</command> can be pipelined to a shell which will execute the NitrOS-9
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
439 commands as they are generated by <command>dsave</command>. Assume that we want to
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
440 copy all files from a directory called <filename class="directory">WORKING</filename> to a directory called
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
441 <filename class="directory">ARCHIVE</filename>:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
442 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
443 <screen>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
444 OS9: chd /d0/WORKING; dsave /d0/ARCHIVE ! shell -p
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
445 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
446 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
447
1093
4dae346c4969 Added crossreferences and lowercased synopsises
roug
parents: 1053
diff changeset
448 <section id="sec4.5">
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
449 <title>Built-in Shell Commands and Options</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
450 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
451 When processing input lines, the shell looks for several special
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
452 names of commands or option switches that are built-in the shell.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
453 These commands are executed without loading a program and creating a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
454 new process, and generally affect how the shell operates. They can
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
455 be used at the beginning of a line, or following any program
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
456 separator (&quot;;&quot;, &quot;&amp;&quot;, or &quot;!&quot;).
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
457 Two or more adjacent built-in
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
458 commands can be separated by spaces or commas.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
459 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
460 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
461 The built-in commands and their functions are:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
462 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
463 <informaltable frame="none">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
464 <tgroup cols="2">
646
2e21fb7216af XMLified.
roug
parents: 144
diff changeset
465 <colspec colwidth="1.5in"/>
2e21fb7216af XMLified.
roug
parents: 144
diff changeset
466 <colspec colwidth="3.5in"/>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
467 <tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
468 <row>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
469 <entry><command>chd</command> <replaceable>pathlist</replaceable></entry>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
470 <entry>change the working data directory to the directory
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
471 specified by the pathlist.</entry>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
472 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
473 <row>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
474 <entry><command>chx</command> <replaceable>pathlist</replaceable></entry>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
475 <entry>change the working execution directory to the
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
476 directory specified by the pathlist.</entry>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
477 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
478 <row>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
479 <entry><command>ex</command> <replaceable>name</replaceable></entry>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
480 <entry>directly execute the module named. This
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
481 transforms the shell process so it ceases
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
482 to exist and a new module begins execution in
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
483 its place.</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
484 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
485 <row>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
486 <entry><command>w</command></entry>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
487 <entry>wait for any process to terminate.</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
488 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
489 <row>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
490 <entry>* <replaceable>text</replaceable></entry>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
491 <entry>comment: &quot;text&quot; is not processed.</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
492 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
493 <row>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
494 <entry><command>kill</command> <replaceable>Proc ID</replaceable></entry>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
495 <entry>abort the process specified.</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
496 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
497 <row>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
498 <entry><command>setpr</command> <replaceable>Proc ID</replaceable> <replaceable>priority</replaceable></entry>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
499 <entry>changes process' priority.</entry>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
500 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
501 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
502 <entry>x</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
503 <entry>causes shell to abort on any error (default)</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
504 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
505 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
506 <entry>-x</entry>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
507 <entry>causes shell not to abort on error</entry>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
508 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
509 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
510 <entry>p</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
511 <entry>turns shell prompt and messages on (default)</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
512 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
513 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
514 <entry>-p</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
515 <entry>inhibits shell prompt and messages</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
516 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
517 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
518 <entry>t</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
519 <entry>makes shell copy all input lines to output</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
520 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
521 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
522 <entry>-t</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
523 <entry>does not copy input lines to output (default)</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
524 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
525 </tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
526 </tgroup>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
527 </informaltable>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
528
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
529
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
530 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
531 The change directory commands switch the shell's working directory
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
532 and, by inheritance, any subsequently created child process. The
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
533 <command>ex</command> command is used where the shell is needed to initiate execution
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
534 of a program without the overhead of a suspended <command>shell</command> process.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
535 The name used is processed according to standard shell operation,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
536 and modifiers can be used.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
537 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
538 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
539
1093
4dae346c4969 Added crossreferences and lowercased synopsises
roug
parents: 1053
diff changeset
540 <section id="sec4.6">
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
541 <title>Shell Procedure Files</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
542 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
543 The shell is a reentrant program that can be simultaneously
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
544 executed by more than one process at a time. As is the case with
1500
b00cf13c9f61 Major changes for new NitrOS-9 manual
boisy
parents: 1094
diff changeset
545 most other NitrOS-9 programs, it uses standard I/O paths for routine
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
546 input and output. specifically, it requests command
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
547 lines from the standard input path and writes its prompts and other
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
548 data to the standard error path.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
549 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
550 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
551 The shell can start up another process also running the shell by
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
552 means of the <command>shell</command> command. If the standard input path is
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
553 redirected to a mass storage file, the new &quot;incarnation&quot; of the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
554 shell can accept and execute command lines from the file instead of
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
555 a terminal keyboard. The text file to be processed is
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
556 called a &quot;procedure file&quot;. It contains one or more command lines
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
557 that are identical to command lines that are manually entered from
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
558 the keyboard. This technique is sometimes called &quot;batch&quot; or
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
559 &quot;background&quot; processing.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
560 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
561 <para>
975
c565a4700689 The entitity replstart was replaced with <replaceable>
roug
parents: 646
diff changeset
562 If the <replaceable>program name</replaceable> specified on a shell command line can not be
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
563 found in memory or in the execution directory, shell will search the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
564 data directory for a file with the desired name. If one is found,
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
565 shell will automatically execute it as a procedure file.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
566 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
567 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
568 Execution of procedure files have a number of valuable
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
569 applications. It can eliminate repetitive manual entry of commonly-used
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
570 sequences of commands. It can allow the computer to execute a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
571 lengthy series of programs &quot;in the background&quot; while the computer is
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
572 unattended or while the user is running other programs &quot;in the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
573 foreground&quot;.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
574 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
575 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
576 In addition to redirecting the shell's standard input to a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
577 procedure file, the standard output and standard error output can be
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
578 redirected to another file which can record output for later review
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
579 or printing. This can also eliminate the sometimes-annoying output
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
580 of shell messages to your terminal at random times.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
581 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
582 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
583 Here are two simple ways to use the shell to create another
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
584 shell:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
585 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
586 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
587 OS9: shell &lt;procfile
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
588
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
589 OS9: procfile
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
590 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
591 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
592 Both do exactly the same thing: execute the commands of the file
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
593 <filename>procfile</filename>. To run the procedure file in a &quot;background&quot; mode you
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
594 simply add the ampersand operator:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
595 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
596 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
597 OS9: procfile&amp;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
598 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
599 <para>
1500
b00cf13c9f61 Major changes for new NitrOS-9 manual
boisy
parents: 1094
diff changeset
600 NitrOS-9 does not have any constraints on the number of jobs that can be
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
601 simultaneously executed as long as there is memory available. Also, the procedure files can themselves cause sequential or
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
602 concurrent execution of additional procedure files. Here's a more
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
603 complex example of initiating two processing streams with
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
604 redirection of each shell's output to files:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
605 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
606 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
607 OS9: proc1 T &gt;&gt;stat1&amp; proc2 T &gt;&gt;stat2&amp;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
608 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
609 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
610 Note that the built-in command &quot;T&quot; (copy input lines to error
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
611 output) was used above. They make the output file contain a record
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
612 of all lines executed, but without useless &quot;OS9&quot; prompts intermixed.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
613 The &quot;-x&quot; built-in command can be used if you do
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
614 <emphasis>not</emphasis> want processing
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
615 to stop if an error occurs. Note that the built-in commands only
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
616 affect the shell that executes them, and not any others that may
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
617 exist.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
618 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
619 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
620
1093
4dae346c4969 Added crossreferences and lowercased synopsises
roug
parents: 1053
diff changeset
621 <section id="sec4.7">
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
622 <title>Error Reporting</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
623 <para>
1500
b00cf13c9f61 Major changes for new NitrOS-9 manual
boisy
parents: 1094
diff changeset
624 Many programs (including the shell) use NitrOS-9's standard error
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
625 reporting function, which displays an error number on the error
1094
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
626 output path. The standard error codes are listed in the <xref linkend="errorcodes"/> of
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
627 this manual. If desired, the <command>printerr</command> command can be executed,
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
628 which replaces the smaller, built-in error display routine with a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
629 larger (and slower) routine that looks up descriptive error messages
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
630 from a text file called <filename>/dd/sys/errmsg</filename>.
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
631 Once the <command>printerr</command>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
632 command has been run it cannot be turned off. Also, its effect is
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
633 system-wide.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
634 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
635 <para>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
636 Programs called by the shell can return an error code in the CPU's
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
637 &quot;B&quot; register (otherwise B should be cleared) upon termination. This
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
638 type of error, as well as errors detected by the shell itself, will
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
639 cause an error message to be displayed and processing of the command
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
640 line or procedure file to be terminated unless the &quot;-x&quot; built-in
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
641 command has been previously executed.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
642 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
643 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
644
1093
4dae346c4969 Added crossreferences and lowercased synopsises
roug
parents: 1053
diff changeset
645 <section id="sec4.8">
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
646 <title>Running Compiled Intermediate Code Programs</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
647 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
648 Before the shell executes a program, it checks the program
1014
d9ed9d44b70c Some character entities had missing semicolons. It's &CPU;
roug
parents: 1011
diff changeset
649 module's language type. If its type is not &CPU; machine language,
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
650 shell will call the appropriate run-time system for that module.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
651 Versions of the shell supplied for various systems are capable of
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
652 calling different run-time systems. Most versions of shell call
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
653 Basic09 when appropriate, and Level Two versions of shell can also
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
654 call the Pascal P-code interpreter (PascalN), or the CIS Cobol
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
655 runtime system (RunC).
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
656 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
657 <para>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
658 For example, if you wanted to run a Basic09 I-code module called
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
659 <command>adventure</command>, you could type the command given below:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
660 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
661 <screen>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 975
diff changeset
662 OS9: basic09 adventure
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
663 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
664 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
665 Or you could accomplish the same thing by typing the following:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
666 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
667 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
668 OS9: adventure
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
669 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
670 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
671
1093
4dae346c4969 Added crossreferences and lowercased synopsises
roug
parents: 1053
diff changeset
672 <section id="sec4.9">
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
673 <title>Setting Up Timesharing System Procedure Files</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
674
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
675 <para>
1500
b00cf13c9f61 Major changes for new NitrOS-9 manual
boisy
parents: 1094
diff changeset
676 NitrOS-9 systems used for timesharing usually have a procedure file
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
677 that brings the system up by means of one simple command or by using
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
678 the system <filename>startup</filename> file. A procedure file which initiates the
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
679 timesharing monitor for each terminal is executed to start up the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
680 system. The procedure file first starts the system clock, then
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
681 initiates concurrent execution of a number of processes that have
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
682 their I/O redirected to each timesharing terminal.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
683 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
684 <para>
1094
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
685 Usually one <command>tsmon</command> command program is started up concurrently for
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
686 each terminal in the system. This is a special program which
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
687 monitors a terminal for activity. When a carriage return character
1094
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
688 is typed on any of these terminals, the <command>tsmon</command> command initiates the
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
689 <command>login</command> command program. If a user does not enter a correct password
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
690 or user number in three tries, the <command>login</command> command will be aborted.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
691 Here's a sample procedure file for a 4-terminal timesharing system
1094
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
692 having terminals names <quote>TERM</quote>, <quote>T1</quote>,
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
693 <quote>T2</quote>, and <quote>T3</quote>.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
694 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
695 <programlisting>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
696 * system startup procedure file
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
697 echo Please Enter the Date and Time
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
698 setime &lt;/term
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
699 printerr
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
700 tsmon /t1&amp;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
701 tsmon /t2&amp;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
702 tsmon /t3&amp;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
703 </programlisting>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
704 <para>
1094
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
705 NOTE: This <command>login</command> procedure will not work until a password file
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
706 called <filename>/DD/SYS/PASSWORD</filename> has been created. For more information,
1094
958740284209 Use <emphasis> instead of CAPITALS
roug
parents: 1093
diff changeset
707 please see the <command>login</command> command description.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
708 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
709 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
710 The example above deserves special attention. Note that the
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1014
diff changeset
711 <command>setime</command> command has its input redirected to the system console
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
712 &quot;term&quot;, which is necessary because it would otherwise attempt to
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
713 read the time information from its current standard input path,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
714 which is the procedure file and not the keyboard.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
715 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
716 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
717 </chapter>