-------------------------------------- 3]AmigaDOS PRIMER: Series 3]By Brad Webb, Contributing Editor 3]321 N. Monroe St., Watertown, WI 53094 -------------------------------------- 3]NOTES FOR NEWCOMERS The shell and the CLI (Command Line Interface) windows are special areas provided by the Amiga's operating system. You can type a entire language of commands at the prompts that appear in these windows. Studying these commands and the power they give you is the purpose of this column. The shell icon is found in the main window of Workbench 1.3 disks, the CLI icon is in the system drawer. Because Jumpdisk is distributed on disk rather than on paper, and because the Amiga is multitasking and can do several things at once, you may work with this column and its exercises in a special way. You can make an "AmigaDOS Primer" disk that will let you read the column on screen and work the exercises at the same time. You do need to be familiar with manipulating disk and file icons from the Workbench, so review how to do that in your Amiga users' manual if you a bit unsure of yourself. Then follow these simple steps: 1. Make a copy of your Workbench disk. Rename it "PrimerDisk". 2. Delete some files to make room: From the System drawer, InitPrinter, MergeMem and FixFonts can go. From Utilities, Calculator, Clock, GraphicDump and ClockPtr can go. 3. Drag the icon for this column onto your new disk. It's the Primer icon in the Jumpdisk window. If your system has only one drive, open the PrimerDisk by double-clicking on its icon. Leave that window open, place Jumpdisk in the drive and open its window. Drag the icon into the PrimerDisk's window. Follow the on-screen disk-swapping instructions. 4 Copy the READ program onto your new disk. since it has no icon, it must be copied by typing in a Shell or CLI window: copy j:read to primerdisk: Now, you can double-click on the column icon on the Primerdisk and a window will open with the column inside it. Using the fore and aft gadgets in the upper right corner of the disk, pop through to the PrimerDisk window. Double-click on the shell icon to open a shell window. Use the fore and aft gadgets to place the shell window on top of the column window, with the PrimerDisk window behind all the others. Now you can read the column in the large window while working the exercises in the shell window. Just remember that you have to click once in a window to make it active. That is, to see more text in the Primer window you click in it once, then use the scroll gadgets on the right. To work an exercise in the shell window, you click once in it, then type a command. To close the shell window (or a CLI window) type "endcli" and press the RETURN key. When have finished with this month's column, delete it from your PrimerDisk and put the disk away until next month. Then, all you need do is drag the icon for the new column onto your PrimerDisk and you will be ready to go. Of course, if you prefer you can print this column on paper and use it that way, or just read it and then try the exercises. If you do go to the effort of making a PrimerDisk, you will get more from the exercises. 3]TOPIC FOR THE MONTH - WHAT'S NEW FROM 1.2 I propose that in the next few columns we review commands we covered in earlier columns, with an eye to studying the new elemenents added by version 1.3 of AmigaDOS. For all who may have missed the earlier columns, the summary charts at the end of each session will list all the keywords and options for each command. As we did way back when we began our travels through AmigaDOS, let's start with some fundamental commands. Few commands are more fundamental than DIR, so let's start there. Because we do have newcomers to this column, we will not just ignore the DOS command features that already existed in version 1.2 and earlier. I hope those of you who have been with me a while and are already familiar with this material will treat it as a review. 3]NEW DIRECTORY DIRECTIONS As we usually do, let's take a look at the command's argument template for a summary of the keywords and options you can use with it. In the shell or CLI window, type dir ? That's one space before the question mark. means to press the RETURN key, not to type the word. You should see the following: DIR,OPT/K,ALL/S,DIRS/S,FILES/S,INTER/S: _ with the cursor patiently waiting one space away from the end of the text. Users of DOS 1.2 will note the addition of the keywords ALL, DIRS, FILES and INTER. In other words, most of the keywords are new! These are the ones we will be examining in detail. ALL = OPT A Let's look first at the ALL/S portion of the argument template. It tells us that DIR has a keyword ALL, and that ALL is a switch. The new ALL switch accomplishes exactly the same thing as typing OPT A,which tells DIR to use the OPTion called up by the letter A, which is short for ALL. The new keyword was added to make it simpler to remember how to obtain an indented directory. The older method (OPT A) was retained for compatiblity with earlier versions of DOS. To prove this to yourself, at your DOS prompt in the shell type: dir all You should see an indented directory of all the files on your disk. You can stop this list at any time by pressing the space bar. To start it scrolling by again, press the back-space key. Try it again, using the space bar and back-space key a few times to see how that works. You can actually use any key start the scrolling again, but AmigaDOS will attempt to respond to any keys other than the backspace, as if you were typing commands. You may get some strange error messages if you don't use the back-space key. Now, just to prove that DIR ALL is the same as DIR OPT A, type: dir opt a You will see the same list as before. It is to Commodore-Amiga's credit they made this "all" option easier to use without requiring everyone familiar with the old method to learn a new one. Even more important, retaining the older method means users with execute (batch) files written under the old method do not have to rewrite their files to make them work under DOS 1.3. We will see this careful approach to updating DOS applies throughout the DIR keywords, and the other DOS commands as well. 3]CHECKING ON THE DIRECTORIES A second OPTion you have with the DIR command is called up with the letter D. This one shows only the subdirectories of whatever directory you are examining. To see it in action, type: dir opt d You will be presented with a listing of all subdirectories in the current directory. None of the file names will be printed to the screen. This option is handy on a disk where many of files make it difficult to see all the subdirectories. As with the OPT A option, 1.3 gives an easier way to look at subdirectories. If you guessed the switch keyword DIRS/S in the argument template accomplishes this feat, you are ahead of the class. Try that now at the DOS prompt in the shell. Type: dir dirs Once again, all the subdirectories on the disk will be listed. 3]THE THIRD KEYWORD: INTER There is one other OPTion available with the DIR command. The option letter is I, and the new DOS 1.3 keyword that accomplishes the same thing is the switch INTER. They stand for "interactive". This option allows you to modify the actions of the DIR command, while it is executing. To look at how this works, in the shell window, type either: dir opt i or dir inter This time, AmigaDOS displays your directory one line at a time. After each line it will display a question mark. To see the next item, press . Files in subdirectories are not automatically shown as with the A/ALL option. If you want to see what is in a subdirectory,type E for "enter" then when a subdirectory is displayed. This interaction with the DIR command gives you the ability to see files in just the subdirectories you choose. If you've been with this column a while, you may remember there are five other responses you can make to the INTER or OPT I question mark prompt: -- You can press Q at any time, and the DIR command will stop working (q = quit). -- You can press B and the DIR command will back up one directory level (b = backup). 3]Caution - Danger Ahead!! -- The third response is dangerous so let's look at it in some detail. If you type the letters d e and l, then return, a subdirectory or file will be deleted from your disk (del = delete). Be careful experimenting with this one! The DEL response only works on a subdirectory if it is empty (has no files in it). It is not so particular about deleting a file. It will go ahead and do it with no chance for you to change your mind if you tell it to. That is one reason I ask you to only work with copies of your disks when doing our experiments. -- The fourth response you can make to the DIR interactive question mark is T . If the line currently being displayed refers to a file, the file will be typed to the screen (t = type). The T and the E responses together can be very helpful in scanning a disk of text files quickly. There is one caution when using the T response. If the file you type to the screen contains anything other than just text, strange things can happen to your display. No permanent damage is done, but it can be spectacular and distracting. In some cases, you may have to "reboot" the computer. 3]A NEW INTERACTION WITH 1.3 -- The fifth response is new to DOS 1.3. You can type the letter C (for command) when in interactive mode. DIR will let you enter any other DOS command, will execute that command, and will then return you to where you were. One possible use for this new feature would be to see how large the files are in a directory that you are exploring. This is accomplished by using AmigaDOS's LIST command after the C response. Let's take a look at how this would work. In the shell, type: dir inter Press the RETURN key until you get to the "devs" directory, and then enter it by typing e After a brief while the first file stored in the devs directory will be shown on the screen. Now, let's assume we want to know the sizes of all the files in this directory. We can find out by typing: c list The C in our example is our response to DIR's question mark prompt. It tells DIR a command is coming. LIST is the command itself and devs states what it is we want LISTed. All the files stored in the devs directory will be LISTed to the screen, along with a bunch of information about each. One item of information is the size of the file in bytes of memory. This is the number to the right of the space that follows the file name itself. A byte of memory can hold one character, such as a single letter or numeral. Any command you type after the c will take effect in the current directory. There is a way to make your commands act on another directory. Let's get a listing of the files in our libs directory. At your DIR ? prompt, type: c This time, DIR will prompt you for more information by printing: Command ? to the screen. Type: dir df0:libs and, assuming your Workbench or PrimerDisk is in df0:, you will see all the files in the libs directory. If you had typed the whole command at once right after the interactive ? prompt ("c list df0:libs") you would have gotten an error message. I'm not sure why the authors of AmigaDOS made it necessary to type the command in two parts in order to work with a directory other than the current one, but at least you can do it. If you type any DOS command in a manner DIR can't interpret, you will see the prompt "Invalid response - try again :" and DIR will give you another chance. Once it has acted on your command, you will be returned to the DIR command itself, right where it left off. 3]FILES OF ANOTHER KIND There is one other keyword to explore. This is the FILES/S switch. In the same manner OPT D and DIRS/S cause DIR to show only the subdirectories stored in the current directory, FILES/S just the files there. Try it. In the shell type: dir files and all the files in your directory will be shown, but none of the subdirectories will be. Since FILES/S is new with DOS 1.3, there is no corresponding OPT F, since that option was not available in earlier DOSes. 3]DIR IN SUMMARY Let's summarize the DIR command and its argument template. Command: DIR Argument Template: DIR,OPT/K,ALL/S,DIRS/S,FILES/S,INTER/S: Keywords: OPT, ALL, DIRS, FILES, INTER Use: The following option specifiers can be used with the keyword OPT: A (All - show an indented directory, including all subdirectories) D (Shows only the subdirectory names) I (Interactive - let the user select command action for each line of the directory as it is listed.) Responses to ? prompt of I (Interactive) option: E (enter, if a sub-directory is being shown) Q (quit the DIR command) B (go back a level if one exists. Quit if at root directory.) T (type the entry being displayed, if a file) DEL (delete the entry being displayed, if a file or empty sub-directory) C followed by any other DOS command will execute the DOS command, then return you to the DIR command in process. The ALL keyword works just like the OPT A combination. The DIRS keyword works just like the OPT D combination. The INTER keyword works just like the OPT I combination. The FILES keyword let's you see just the files stored in the current directory. Subdirectories are ignored. Examples: dir dir dfn: (where n is any legal Amiga drive number: df0:, df1:, etc.) dir opt a dir opt d dir opt i dir files dir all dir opt ai The a and i options can be combined. "dir all inter" works too. Try either combination as an experiment. 3]THAT DOES IT That covers the DIR command, so we will stop here this time. Next month -- another 1.3 command will be analyzed. Meanwhile, I would very much like to hear from some readers who have taken the time to make a "PrimerDisk" and use it. Did you find it easy or difficult to follow the instructions given? How much does it help in your exploration of DOS commands -- or doesn't it? Please let me know. And, above all, keep playing with DOS and have fun. 4]END OF TEXT