Mercurial > hg > Members > kono > nitros9-code
annotate docs/nitros9guide/chap2.chapter @ 1017:c9b63a3c0a17
More changes
author | boisy |
---|---|
date | Tue, 04 Mar 2003 20:47:34 +0000 |
parents | d9ed9d44b70c |
children | b5ff125a1d60 |
rev | line source |
---|---|
144 | 1 <chapter> |
2 <title>Basic Interactive Functions</title> | |
3 | |
4 <section> | |
5 <title>Running Commands and Basic Shell Operation</title> | |
6 <para> | |
7 The "shell" is a the part of OS-9 that accepts commands from your | |
8 keyboard. It was designed to provide a convenient, flexible, and | |
9 easy-to-use interface between you and the powerful functions of the | |
10 operating system. The shell is automatically entered after OS-9 is | |
11 started up. You can tell when the shell is waiting for input | |
1011 | 12 because it displays the shell prompt. This prompt indicates that |
144 | 13 the shell is active and awaiting a command from your keyboard. It |
14 makes no difference whether you use upper-case letters, lower-case | |
15 letters, or a combination of both because OS-9 matches letters of | |
16 either case. | |
17 </para> | |
18 <para> | |
19 The command line always begins with a name of a program which can | |
20 be: | |
21 </para> | |
22 | |
23 <itemizedlist> | |
24 <listitem><para>The name of a machine language program on disk</para></listitem> | |
25 <listitem><para>The name of a machine language program already in memory</para></listitem> | |
26 <listitem><para>The name of an executable program compiled by a high-level | |
1011 | 27 language such as Basic09, Pascal, Cobol, etc.</para></listitem> |
28 <listitem><para>The name of a procedure file</para></listitem> | |
144 | 29 </itemizedlist> |
30 <para> | |
31 If you're a beginner, you will almost always use the first case, | |
32 which causes the program to be automatically loaded from the CMDS | |
33 directory and run. | |
34 </para> | |
35 <para> | |
36 When processing the command line, the shell searches for a | |
37 program having the name specified in the following sequence: | |
38 </para> | |
39 | |
40 <orderedlist numeration="arabic"> | |
41 | |
1011 | 42 <listitem><para> If the program named is already in memory, it is run.</para></listitem> |
144 | 43 |
1011 | 44 <listitem><para> The "execution directory", usually "CMDS", is searched. |
144 | 45 If a file having the name given is found, it is loaded and |
1011 | 46 run.</para></listitem> |
144 | 47 |
1011 | 48 <listitem><para> The user's "data directory" is searched. If a file having |
144 | 49 the name given is found, it is processed as a "procedure |
50 file" which means that the file is assumed to contain one | |
51 or more command lines which are processed by the shell in | |
52 the same manner as if they had manually typed in one by one.</para></listitem> | |
53 | |
54 </orderedlist> | |
55 <para> | |
56 Mention is made above of the "data directory" and the "execution | |
57 directory". At all times each user is associated with two file | |
58 directories. A more detailed explanation of directories is presented | |
1011 | 59 later. The execution directory (usually CMDS) includes |
144 | 60 files which are executable programs. |
61 </para> | |
62 <para> | |
63 The name given in the command line may be optionally followed by | |
64 one or more "parameters" which are passed to the program called by | |
65 the shell. | |
66 </para> | |
67 <para> | |
68 For example, in the command line: | |
69 </para> | |
70 <screen> | |
1011 | 71 list file1 |
144 | 72 </screen> |
73 <para> | |
74 the program name is LIST, and the parameter passed to it is FILE1. | |
75 </para> | |
76 <para> | |
77 A command line may also include one or more "modifiers" which are | |
78 specifications used by the shell to alter the program's standard | |
1011 | 79 input/output files or memory assignments. |
144 | 80 |
81 | |
82 </para> | |
83 <section> | |
84 <title>Sending Output to the Printer</title> | |
85 <para> | |
1014
d9ed9d44b70c
Some character entities had missing semicolons. It's &CPU;
roug
parents:
1011
diff
changeset
|
86 Normally, most commands and programs display output on the &make; video display. The output of these programs can |
144 | 87 alternatively be printed by specifying output redirection on the |
88 command line. This is done by including the following modifier to | |
89 at the end of any command line: | |
90 </para> | |
91 <screen> | |
1011 | 92 >/p |
144 | 93 </screen> |
94 <para> | |
95 The ">" character tells the shell to redirect output (See 4.3.2) to | |
1011 | 96 the printer using the &make;'s printer port, which has the device |
144 | 97 name "/P" (See 3.2). For example, to redirect the output of the |
98 "dir" command to the printer, enter: | |
99 </para> | |
100 <screen> | |
1011 | 101 dir >/p |
144 | 102 </screen> |
103 <para> | |
104 The "xmode" command can be used to set the printer port's | |
105 operating mode such as auto line feed, etc. For example, to examine | |
106 the printer's current settings, type: | |
107 </para> | |
108 <screen> | |
1011 | 109 xmode /p |
144 | 110 </screen> |
111 <para> | |
112 To change any of these type XMODE followed by the new value. | |
113 For example, to set the printer port for automatic line feeds at the | |
114 end of every line, enter: | |
115 </para> | |
116 <screen> | |
1011 | 117 xmode /p lf; |
144 | 118 </screen> |
119 </section> | |
120 </section> | |
121 | |
122 <section> | |
123 <title>Shell Command Line Parameters</title> | |
124 <para> | |
125 Parameters are generally used to either specify file name(s) or | |
126 to select options to be used by the program specified in the command | |
127 line given to the shell. Parameters are separated from the command | |
128 name and from each other by space characters (hence parameters and | |
129 options cannot themselves include spaces). Each command program | |
130 supplied with OS-9 has an individual description in the last section | |
131 of this manual which describe the correct usage of the parameters of | |
132 each command. | |
133 </para> | |
134 <para> | |
135 For example, the LIST program is used to display the contents of | |
136 a text file on your display. It is necessary to tell to the LIST | |
137 program which file it is to be displayed, therefore, the name of the | |
138 desired file is given as a parameter in the command line. For | |
139 example, to list the file called startup (the system initialization | |
140 procedure file), you enter the command line: | |
141 </para> | |
142 <screen> | |
1011 | 143 list startup |
144 | 144 </screen> |
145 <para> | |
146 Some commands have two parameters. For example, the COPY command is | |
147 used to make an exact copy of a file. It requires two parameters: | |
148 The name of the file to be copied and the name of the file which is | |
149 to be the copy, for example: | |
150 </para> | |
151 <screen> | |
1011 | 152 copy startup newstartup |
144 | 153 </screen> |
154 <para> | |
155 Other commands have parameters which select options. For example: | |
156 </para> | |
157 <screen> | |
1011 | 158 dir |
144 | 159 </screen> |
160 <para> | |
161 shows the names of the files in the user's data directory. Normally | |
1011 | 162 it simply lists the file names only, but if the "-e" |
144 | 163 (for <emphasis>e</emphasis>ntire) |
164 option is given, it will also give complete statistics for each file | |
165 such as the date and time created, size, security codes, etc. To do | |
166 so enter: | |
167 </para> | |
168 <screen> | |
1011 | 169 dir -e |
144 | 170 </screen> |
171 <para> | |
172 The DIR command also can accept a file name as a parameter which | |
173 specifies a directory file other than the (default) data directory. | |
174 For example, to list file names in the directory sys , type: | |
175 </para> | |
176 <screen> | |
1011 | 177 dir sys |
144 | 178 </screen> |
179 <para> | |
180 It is also possible to specify both a directory name parameter and | |
181 the e option, such as: | |
182 </para> | |
183 <screen> | |
1011 | 184 dir sys -e |
144 | 185 </screen> |
186 <para> | |
1011 | 187 giving file names and complete statistics. |
144 | 188 </para> |
189 </section> | |
190 | |
191 <section> | |
192 <title>Some Common Command Formats</title> | |
193 <para> | |
194 This section is a summary of some commands commonly used by new | |
195 or casual OS-9 users, and some common formats. Each command is | |
196 followed by an example. Refer to the individual command | |
1011 | 197 descriptions later int his book for more detailed information and |
144 | 198 additional examples. Parameters or options shown in brackets are |
199 optional. Whenever a command references a directory file name, the | |
200 file <emphasis>must</emphasis> be a directory file. | |
201 | |
202 <screen> | |
203 CHD filename chd DATA.DIR | |
204 </screen> | |
205 Changes the current <emphasis>data</emphasis> working directory to | |
206 the <emphasis>directory</emphasis> file specified. | |
207 <screen> | |
208 COPY filename1 filename2 copy oldfile newfile | |
209 </screen> | |
210 Creates filename2 as a new file, then copies all data from | |
211 "filename1" to it. "filename1" is not affected. | |
212 <screen> | |
213 DEL filename del oldstuff | |
214 </screen> | |
215 Deletes (destroys) the file specified. | |
216 <screen> | |
1011 | 217 DIR [filename] [-e] [-x] dir myfiles -e |
144 | 218 </screen> |
1017 | 219 List names of files contained in a directory. If the "-x" option is |
144 | 220 used the files in the current <emphasis>execution</emphasis> |
221 directory are listed, | |
222 othervise, if no directory name is given, the current | |
223 <emphasis>data</emphasis> directory will be listed. | |
1017 | 224 The "-e" option selects the long format |
144 | 225 which shows detailed information about each file. |
226 <screen> | |
227 FREE devicename free /d1 | |
228 </screen> | |
229 Shows how much free space remains on the disk whose name is given. | |
230 <screen> | |
231 LIST filename list script | |
232 </screen> | |
233 Displays the (text) contents of the file on the terminal. | |
234 <screen> | |
235 MAKDIR filename makdir NEWFILES | |
236 </screen> | |
237 Creates a new directory file using the name given. Often followed | |
238 by a "chd" command to make it the new working data directory. | |
239 <screen> | |
240 RENAME filename1 filename2 rename zip zap | |
241 </screen> | |
242 Changes the name of filename1 to filename2. | |
243 </para> | |
244 </section> | |
245 | |
246 <section> | |
247 <title>Using the Keyboard and Video Display</title> | |
248 <para> | |
148
525b12e17d60
Made the word "Dragon" an entity, thereby making it replacable with "Color"
roug
parents:
144
diff
changeset
|
249 OS-9 has many features to expand the capability of the &make; |
144 | 250 keyboard and video display. The video display has screen pause, |
251 upper/lower case, and graphics functions. The keyboard can generate | |
252 all ASCII characters and has a type-ahead feature that permits you | |
253 to enter data before requested by a program (except if the disk is | |
254 running because interrupts are temporarily disabled). Appendix C of | |
255 this manual is a list of the characters and codes that can be | |
256 generated from the keyboard. The keyboard/video display can be used | |
257 as a file known by the name "/TERM". | |
258 </para> | |
259 | |
260 <section> | |
261 <title>Video Display Functions</title> | |
262 <para> | |
1011 | 263 The &make; uses reverse video (green letters in a black box) to |
144 | 264 represent lower-case letters. Normally they are not used, so you |
265 have to turn them on if you want to use them with the command: | |
266 </para> | |
267 <screen> | |
1011 | 268 tmode -upc |
144 | 269 </screen> |
270 <para> | |
271 The screen pause feature stops programs after 16 lines have been | |
272 displayed. Output will continue if you hit any key. Normally this | |
273 feature is on. It can be turned on or off with the TMODE command as | |
274 follows: | |
275 </para> | |
276 <screen> | |
1011 | 277 tmode -pause turns pause mode off |
278 tmode pause turns pause mode on | |
144 | 279 </screen> |
280 <para> | |
281 The display system also has a complete set of commands to emulate | |
282 commercial data terminals, plus a complete set of graphics commands. | |
283 These are described in detail in Appendix D. | |
284 </para> | |
285 </section> | |
286 | |
287 <section> | |
288 <title>Keyboard Shift and Control Functions</title> | |
289 <para> | |
290 Two keys are used in combination with other keys to change their | |
291 meaning. The SHIFT KEY selects between upper case and lower case | |
1014
d9ed9d44b70c
Some character entities had missing semicolons. It's &CPU;
roug
parents:
1011
diff
changeset
|
292 letters or punctuation, and the &ctrlkey; key can be used to generate |
1011 | 293 control characters. |
144 | 294 </para> |
295 <para> | |
296 The keyboard has a shift lock function similar to a typewriter's, | |
297 which is normally "locked". The keyboard's shift lock may be | |
1011 | 298 reversed by depressing the control key and 0 keys |
144 | 299 simultaneously. The shift lock only affects the letter (A-Z) keys. |
300 When the keyboard is locked, these keys generate upper case letters, | |
301 and lower case only if the SHIFT key is depressed. When the | |
302 keyboard is unlocked, the reverse is true, e.g., lower case letters | |
303 are generated unless the SHIFT key is depressed at the same time as | |
304 a letter key. | |
305 </para> | |
306 </section> | |
307 | |
308 <section> | |
309 <title>Control Key Functions</title> | |
310 <para> | |
311 There are a number of useful control functions that can be | |
312 generated from the keyboard. Many of these functions use "control | |
1014
d9ed9d44b70c
Some character entities had missing semicolons. It's &CPU;
roug
parents:
1011
diff
changeset
|
313 keys" which are generated by simultaneously depressing the &ctrlkey; key |
144 | 314 plus some other key. For example, to generate the character for |
1014
d9ed9d44b70c
Some character entities had missing semicolons. It's &CPU;
roug
parents:
1011
diff
changeset
|
315 CONTROL D press the &ctrlkey; and D keys at the same time. |
144 | 316 </para> |
317 <variablelist> | |
318 <varlistentry> | |
319 <term>CONTROL A</term> | |
320 <listitem> | |
321 <para> | |
322 Repeat previous input line. The last line entered will be redisplayed but | |
323 <emphasis>not</emphasis> processed, with the cursor positioned at the end of | |
324 the line. You may hit return to enter the line, or edit the line by | |
325 backspacing, typing over characters to correct them, and entering | |
326 control A again to redisplay the edited line. | |
327 </para> | |
328 </listitem> | |
329 </varlistentry> | |
330 <varlistentry> | |
331 <term>CONTROL D</term> | |
332 <listitem> | |
333 <para> | |
334 Redisplay present input on next line. | |
335 </para> | |
336 </listitem> | |
337 </varlistentry> | |
338 <varlistentry> | |
339 <term>CONTROL W</term> | |
340 <listitem> | |
341 <para> | |
342 Display Wait - This will temporarily halt output to the display so | |
343 the screen can be read before the data scrolls off. Output is | |
344 resumed when any other key is hit. | |
345 </para> | |
346 </listitem> | |
347 </varlistentry> | |
348 <varlistentry> | |
349 <term>CONTROL 0</term> | |
350 <listitem> | |
351 <para> | |
352 Shift lock. Reverses present shift lock state. | |
353 </para> | |
354 </listitem> | |
355 </varlistentry> | |
356 <varlistentry> | |
357 <term>BREAK KEY (or CONTROL E)</term> | |
358 <listitem> | |
359 <para> | |
360 Program abort - Stops the current running program | |
361 </para> | |
362 </listitem> | |
363 </varlistentry> | |
364 <varlistentry> | |
365 <term>SHIFT BREAK KEY (or CONTROL C)</term> | |
366 <listitem> | |
367 <para> | |
368 Interrupt - Reactivates Shell while keeping program running as | |
369 background task. | |
370 </para> | |
371 </listitem> | |
372 </varlistentry> | |
373 <varlistentry> | |
374 <term>CONTROL BREAK KEY (ESCAPE)</term> | |
375 <listitem> | |
376 <para> | |
377 End-of-File - This key is used to send an end-of-file to programs | |
378 that read input from the terminal in place of a disk or tape file. | |
379 It must be the first character on the line in order for it to be | |
380 recognized. | |
381 </para> | |
382 </listitem> | |
383 </varlistentry> | |
384 <varlistentry> | |
385 <term>LEFT ARROW (OR CONTROL H)</term> | |
386 <listitem> | |
387 <para> | |
388 Backspace - erase previous character | |
389 </para> | |
390 </listitem> | |
391 </varlistentry> | |
392 <varlistentry> | |
393 <term>SHIFT LEFT ARROW (or CONTROL X)</term> | |
394 <listitem> | |
395 <para> | |
396 Line Delete - erases the entire current line. | |
397 </para> | |
398 </listitem> | |
399 </varlistentry> | |
400 </variablelist> | |
401 </section> | |
402 </section> | |
403 | |
404 </chapter> |