Tasks in this section are used les often, but almost every user needs to do these things at some time. These examples assume a certain amount of familiarity with AmigaDOS and the Shell.
The aliases listed below can help speed your Shell work by reducing the number of keystrokes required for common commands.
To enable these as global aliases, edit S:Shell-startup as described previously for User-startup, adding these lines:
ALIAS c0 CD DF0:
ALIAS cs CD SYS:
ALIAS css CD S:
ALIAS d0 DIR DF0:
ALIAS dr DIR RAM:
ALIAS qdir DIR ~ (#?.info)
ALIAS 1s LIST
ALIAS cp COPY
ALIAS cc COPY [] CLONE
ALIAS del DELETE
ALIAS ren RENAME
ALIAS ns NEWSHELL
ALIAS es ENDSHELL
ALIAS pf printfiles
ALIAS fmt0 FORMAT DRIVE DF0: NAME [] FFS NOICONS DIRCACHE
ALIAS edus RUN ED S:User-startup
ALIAS edsh RUN ED S:Shell-startup
ALIAS ednew RUN ED RAM:newfile
ALIAS chip ECHO "There are `avail chip` bytes of Chip memory free."
Modify the alias names as desired. Use these as models for your own aliases.
You can control the Shell window with the WINDOW argument of the NEWSHELL command. It allows you to specify custom sizes, positions, and features for the Shell window. Following are two examples of different window specifications.
To open a convenient Shell window on your Workbench screen, enter the following command in a Shell or as a line in User-startup:
NEWSHELL CON://400/100/Ashell/CLOSE/
ALT0/12/640/388
This creates a small Shell window titled AShell that leaves the left side of the Workbench window clear so that disk icons are not obscured. It has a close gadget and, on a High-Res Interlace screen, it expands to fill the entire screen for the screen title bar when you select its zoom gadget.
To open a Shell window on a public screen, such as telecommunication program's terminal screen, use a window specification with the SCREEN option:
CON:0/20//???/CLOSE/SCREENTerm
This creates a Shell window called ??? that is near the top of the screen and is as wide and short as possible. The window opens on a public screen named Term, if that screen is available. It it is not, the Shell opens on the Workbench screen.
The Shell prompt is easily modified using the PROMPT command. You can add any fixed text to the prompt string and include, reorder, or leave out the substitution operators that display the process number, current directory, and return code. Placing escape sequences in the prompt string lets you make the prompt stand out visually from the command line and command output. You can also embed a command in the prompt with the back apostrophe feature.
Figure 8-2 illustrates two ways of modifying the prompt. The first uses escape sequences to produce a boldface, color 2 (white) prompt; see Appendix D for a listing of escape sequences. The second shifts the usual position of the substitution operators, embeds a DATE command using the back apostrophe, and changes the final character to a dollar sign ($).
Figure 8-2. Sample Uses of PROMPT Command
To have a custom icon for the Ram Disk, you need to place a COPY statement in User-startup. First, create the icon in IconEdit. Make sure it is a Disk type icon, then save it on your boot disk as DEVS:Ramdisk.info.
This example uses the DEVS: directory, but it does not matter where you store this icon. It is not visible, even in Show All Files mode, because Disk icons are visible only in the Workbench window. |
To make your custom Ram Disk icon appear in the Workbench window, enter this line in the S:User-startup file, save the changed file, and reboot:
COPY DEVS:Ramdisk.info TO RAM:disk.info
If you also want to rename Ram Disk, include a RELABEL statement in User-startup after the COPY statement, such as:
To delete a file that has an icon and the file's.info file with a single command:
DELETE <file> <file>.info QUIET
It is sometimes necessary to test the results of certain commands before using them on actual files. This is particularly true when using complex pattern matching with potentially destructive commands, such as DELETE, or escape sequences, with which it can be difficult to predict the outcome. There are various ways of testing commands that are quick and safe.
To test a potentially destructive pattern matching command:
LIST ~ (#?.info|#?.c| [0-9]#?)
To test the effects of escape sequences:
To clear the window and reset all escape sequence modes to the defaults, enter:
You must use a lower case c. After the window is cleared and reset, the Shell displays a harmless :Unknown command message on the window's top line.
To create a test file in the Ram Disk, enter:
1> ECHO "This is only a test" TO RAM:foo
This provides a small, expendable file on which to test other commands. It is best to create such files in RAM:, to avoid cluttering your disks with small, useless files. Traditionally, files like this are named "foo" or "bar."
To test commands safely on actual files, copy the files to a directory in the Ram Disk and test with those files:
1> COPY Work:MyFiles/#? TO RAM:Testdir