Copyright (c) Hyperion Entertainment and contributors.

Difference between revisions of "AmigaOS Manual: AmigaDOS Working With AmigaDOS"

From AmigaOS Documentation Wiki
Jump to navigation Jump to search
Line 220: Line 220:
 
| INFO || Show information on all disks || Observe disk window title bars
 
| INFO || Show information on all disks || Observe disk window title bars
 
|}
 
|}
  +
  +
= AmigaDOS Command Structure =
  +
  +
Every AmigaDOS command has a specific format and syntax that must be used for the system to accept and act on the command. The general rules for working with AmigaDOS commands are few, but absolute:
  +
  +
* A legal command or program name must appear first on the command line. The full path to the command is not necessary if the command is in a directory on the search path.
  +
* Arguments are separated from the command and from each other by spaces; a single space is sufficient, but additional spaces are allowed. No punctuation, other than that specifically needed in the command, should be used.
  +
* AmigaDOS is not case-sensitive. Any mixture of upper and lower case can be used on the command line, however, case is ignored. Capitalization given in file and directory names is preserved.
  +
* Except where noted, when a path or string argument contains a space, the entire path or string must be enclosed in double quotation marks ("). For example:
  +
: 1> ECHO command TO Adisk:Text/Comment
  +
: 1> ECHO "A comment" TO "My Disk:Text/Comment"
  +
* The maximum length of a standard Shell command line is 512 characters.
  +
  +
A sample of the structure of an AmigaDOS command line is illustrated in Figure 3-3. It consists of the COPY command followed by two arguments.
  +
  +
Figure 3-3. Example Command Line
  +
  +
An argument is an additional piece of information the command uses, such as a file name or option. Command arguments are similar to icon Tool Types on the Workbench. Depending on the command, arguments can be optional ir required. Figure 3-3 illustrates the following points about arguments.
  +
  +
* Keywords for AmigaDOS commands are generally full words or simple abbreviations, in this example, FROM and TO.
  +
* An argument can consist of more than one term; in the example, a file name argument accepts two names at the same time: Screenmode and Screenmode.info.
  +
* Some arguments have an identifying keyword, which can be optional or required.
  +
* When optional keywords are omitted in a multiple-argument command, the arguments must appear in the order shown by the command template.
  +
  +
= Special AmigaDOS Characters =
  +
  +
There are several characters that have special meanings when used in AmigaDOS. The functions of special characters include the following:
  +
  +
* Specifying paths
  +
* Pattern matching
  +
* Redirecting command input and output
  +
  +
It is important when using AmigaDOS to remember the various special functions that characters can have. Note that in different contexts the same character can have different effects or have no special effect. If a command that appears correct produces unexpected results, check to see if any character in the command has a special function.

Revision as of 01:38, 25 January 2014

WIP.png This page is currently being updated to AmigaOS 4.x. Some of the information contained here may not yet be applicable in part or totally.

AmigaDOS stores information in the same hierarchical structure as Workbench. AmigaDOS commands have specific rules that you must follow when creating and programs to run on your Amiga. You must be familiar with the terms specific to the file system and with AmigaDOS command concepts to successfully use AmigaDOS. This chapter describes the following:

  • Managing files, directories, and disks
  • Command line basics
  • Types of commands
  • Command structure
  • Special characters
  • Running programs
  • Refining your AmigaDOS environment

Specific commands are fully described in Chapters 6 and 7 of this manual.

Managing Files, Directories, and Disks

In order to use AmigaDOS to access information, you must know where that information is located. On an Amiga, all information is stored in a system of directories and files. This is the same system used by the Workbench, only the method of working with it is different. Most notably, you do not use icons to manipulate the files and directories. See the Workbench User's Guide for detailed information aboutthe Amiga file system and the use of common commands. Use this section to review the following AmigaDOS basic concepts:

  • File system terms
  • File management
  • Naming conventions
  • Keywords

File System Terms

The following are the main elements of the AmigaDOS file system:

Device
A physical device, such as disk drive or printer, or a software (logical) device, such as RAM: or the printer device PRT:.
Partition
A hard disk or part of a hard disk that AmigaDOS treats as a separate device.
Volume
A particular disk or subdivision of a hard disk that AmigaDOS treats as a separate device. Floppy disks and hard disk partitions are volumes.
Directory
Equivalent to a drawer in Workbench.
Root Directory
The top of the filing system for a given volume; the directory that contains all other directories.
Subdirectory
A directory that is contained within another directory.
File
A named collection of data.
Path
The series of device, directory, and subdirectory names that uniquely specifies a particular file and its location.

File Management

AmigaDOS stores information on a device in a file system, which is an organization of directories, subdirectories, and files. Directories and files are arranged in a hierarchical system often referred to as a tree. The branches are directories, which can include subdirectories. At th ends of the branches are the files, unless the directory is empty. Figure 3-1 illustrates a directory tree.

Figure 3-1. Example Directory Tree

Devices

Devices include logical devices and the hardware associated with your Amiga, such as floppy disk drives, hard disk drives, the Ram Disk, RAD:, and peripheral devices. Information stroed on these devices can be accessed using a variety of names.

To access files on a particular volume, you can refer to the volume by its volume name, such as Workbench:, or its device name, such as DF0:. Use the names interchangeably; however, you must always include the colon (:) after the name. When you refer to a disk by volume name, the system searches all the available drives for the volume. If it cannot find a volume of that name, a requester asks you to insert the volume. When you refer to the disk by a particular device name, the system uses whatever volume is inserted in that device.

AmigaDOS has standard names assigned to peripheral devices that are attached to the various ports, as well as to various logical (software) devices. Generally, these devices are used for output, such as copying a file to a printer. The standard device names are:

SYS:
Represents the volume on which the Amiga looks for its basic disk-based resources, such as C: and LIBS:.
PAR:
Represents any device, usually a printer, that is connected to the parallel port. If you copy a file to PAR:, it is sent to the device attached to the parallel port. Output directed here is not modified by any driver software.
SER:
Represents any device connected to the serial port, such as a printer or a modem. Output directed here is not modified by any driver software.
PRT:
Represents the printer. Output to PRT: goes through the selected printer drive and to the serial or parallel port as specified in the Printer editor in the Prefs drawer.
CON:
Represents a console, which uses a window to accept typed input and display text output. The Shell window is one kind of console window.
CONSOLE:
Represents the current console window. An asterisk (*) can also be used in place of CONSOLE:.
NIL:
Represents a dummy device commonly used to prevent output from appearing on the screen. All output sent to NIL: is discarded.
RAM:
Represents the Ram Disk, which is a portion of the Amiga's internal memory that can be used as a storage device. All information in RAM: is lost if the Amiga is rebooted or turned off.
RAD:
Represents a special kind of Ram Disk that is only lost if the system is turned off, but not when rebooted. Refer to Appendix C for detailed information.
DF0:
Represents the Amiga's main internal floppy drive from which the Amiga attempts to boot if there is no other bootable device available.

Directories

Directories are the AmigaDOS equivalent to drawers in Workbench. They allow you to group and classify related files. Each file on a disk is located in a directory. An empty, formatted disk contains one directory, the root directory. If you create a file on an empty disk, that file resides in the root directory. If the file has an icon attached to it, the icon appears in the disk window.

Directories can contain other directories, called subdirectories. The Amiga supports an arbitrary number of nested directories (directories within directories).

Files

A file, the basic unit of storage on a computer, is an organized collection of information. All the programs and any permanent data that a program uses or produces are files. Project icons represent data files. Data files contain the information created or used by a program, such as text, graphic, or spreadsheet files.

.Info Files

Another type of file used by the Amiga is a .info file (pronounced dot info file). The .info files contain the icons that appear on the Workbench screen. Every file or directory that has on icon also has a corresponding .info file. In addition to storing the graphics and position data for the icon image, a .info file contains any Default Tool or Tool Type information entered into the icon's Information window.

When working through the Shell, AmigaDOS does not automatically associate .info files with the corresponding files or directories. For example, if you use the COPY command to copy the Clock file from the Utilities directory to the System directory, the Clock.info file is not copied with it like it is when you drag the Clock icon from one drawer to another in Workbench. In AmigaDOS, to be sure the Clock icon appears in the System drawer, you must also copy the Clock.info file.

When you change icon images by copying .info files, you need to copy an icon of the same type as the item it represents: Tool, Project, Drawer, Disk, or Trashcan. If the icon's type does not match the type of file it represents, it may not open from the Workbench. Icon type is displayed in the icon's Information window and can be changed with the IconEdit program.

Each disk icon has a corresponding disk.info file. If you delete the disk.info file, a default disk icon automatically replaces the previous icon.

Naming Conventions

The following naming conventions apply to file and directory names:

  • Names can be up to 30 characters long and can contain upper case letters and any punctuation marks that are not reserved. Workbench file and drawer names can only be up to 25 characters long to accommodate a possible .info extension.
  • Colons (:) and slashes (/) are reserved and cannot be used in file or directory names. Semicolons (;), asterisks (*), parentheses (()), question marks (?), back apostrophes (`), number or pund signs (#), square brackets ([]), angle brackets (<>), tildes (~), vertical bars (|), dollar signs ($), double quotation marks ("), and percent signs (%) are not reserved; however, we recommend that you do not use these characters in your file or directory names because they have special meaning in AmigaDOS.
  • Capitalization used in file names is preserved even though AmigaDOS is not case-sensitive. The name is recognized by the characters; for example, TextFile is treated the same as textfile.
  • Spaces in names are allowed, but not recommended when working through AmigaDOS. If you do use names with spaces, the entire path containing the name must be enclosed in double quotation marks. We recommend using an underscore (_) as a separator rather than a space.
Note
If your use spaces in file names, do not place one at the beginning or end of the name. This space is invisible when displayed and easily overlooked as part of the file name. AmigaDOS does not recognize the name if such a space is not entered.

Keywords

A keyword is a special word recognized by an AmigaDOS command. AmigaDOS commands use keywords to identify arguments or to specify options. If there is a conflict between a name and a command keyword, enclosing the name in quotation marks ensures that it is interpreted as a name. For example, if you have a directory named Files and you want to display information about all of its files and subdirectories, you might use the command LIST Files. However, this is ambiguous because LIST has the keyword FILES: To avoid this, enter:

LIST "Files"

Command Line Basics

Effectively using a Command Line Interface, such as the Amiga Shell, requires that you understand concepts unique to this method of working with your computer. These include:

  • The distinctions between files, programs, commands, and scripts
  • The search path
  • The current directory

Files, Programs, Commands, and Scripts

Files, programs, commands, and scripts are named collections of data that can be stored in the computer's memory or on a disk drive. These concepts can be confusing because the meanings of the terms often overlap.

Files

Programs, commands, and scripts are all files. Files can be stored on disk or in the Amiga's memory, although certain kinds of files are customarily stored in specific locations.

Programs

A program is a file that the computer executes to accomplish some task. Software that you buy for the Amiga are mostly programs. Workbench programs are called tools, utilities, or editors. A file that is not a program is typically a data file, which contains information a program can use, such as text or graphics. Programs can be stored anywhere.

Commands

A command is a type of program. The term command usually refers to programs that are executed through a command line such as the Shell, especially those programs that come with a computer as part of the operating system and perform some basic function. The programs detailed in Chapter 6 of this book are the AmigaDOS commands. AmigaDOS commands that are not Internal (built into the Shell) are stored in the C: directory.

The term command can also refer to a specific instance of that program's invocation, including its arguments, if any. In this manual, the term command line is used to indicate a command program's invocation; for example, "The command line TYPE S:User-startup is an example of the TYPE command." The command must always be the first thing on the command line.

Scripts

A script is another type of program that is a text file containing a series of commands comprising the program. You can view and edit a script with a text editor. A script typically performs some simple task than can be modified by editing the script.

In this manual, the term script refers to scripts of AmigaDOS commands. AmigaDOS scripts are customarily stored in the S: directory. ARexx programs are also called scripts, although they can the S: directory using the assignment REXX:. Some computer systems refer to scripts as batch files.

Search Path

When using the Shell, the Amiga must know where to look for the commands you want to use. The Shell has a search path, which allows you to enter commands without providing the full path. The search path is a series of directories that AmigaDOS searches to find commands that are entered without paths.

The default search path includes the current directory, C:, and several other directories specified in the standard Startup-sequence. You can add other directories in which you keep frequently-used programs by using the PATH command or by using multiple assignments with the ASSIGN command. There is, however, a significant difference between these two methods. Directories added to the search path with the PATH command are local to the Shell in which you added them and to any sub-Shells launched from that Shell. Directories added through multiple assignments with the ASSIGN command are global to the whole system.

When you enter something in the Shell, AmigaDOS looks through the directories in the search pth for a command of that name. It searches the directories in the order they appear in the path until it either finds the command or reaches the end of the path list. When a command cannot be found in any of the search path directories, the Shell displays an Unknown command message, as illustrated in Figure 3-2.

Figure 3-2. Search Path

Note
AmigaDOS uses the search path to find commands only. You must include a full path to any files referred to in a command's arguments.

Current Directory

The current directory is the Shell's current location in the filing system hierarchy, similar to the Workbench's current window. The name of the current directory is displayed in the default Shell prompt so that you always known where you are. The following properties apply to the current directory:

  • Each Shell has its own independent current directory.
  • A Shell has only one current directory.
  • The current directory is always the first directory in the search path.
  • The path up to and including the current directory is assumed and does not need be included in a path to a particular command that is within the current directory.
  • The current directory is the default directory, the directory on which a command operates, if no other directory is specified.

Changing the current directory, like adding directories to the search path, is a way to reduce the amount of typing necessary to specify a command. Often you need to perform several operations within a certain directory, such as copying, renaming, and deleting files. You can avoid entering the full path for each file by changing the current directory to that directory in which most of the files are located.

Types of Commands

AmigaDOS has both disk-based and internal commands.

Disk-based commands must be loaded from a disk before execution. On systems with hard disks, the disk-based commands are always accessible to the system since they are automatically loaded when invoked. On a floppy-only system, these commands are read from a floppy disk that must be inserted whenever they are called.

Internal commands reside in the Shell, which is in ROM (Read Only Memory). The system accesses internal commands immediately.

Some AmigaDOS commands are essentially the same as menu items or programs on the Workbench. These commands and the corresponding Workbench equivalent are shown in the following table:

Command Function Workbench Counterpart
CD Change the current directory Select another window/icon
COPY Copy a file, directory or disk Copy menu item
DATE Set the correct date and time Prefs/Time editor
DELETE Delete a file or directory Delete menu item
DIR Show files in a directory Show All Files menu item
DISKCOPY Copy a disk Copy menu item
ENDSHELL Close a Shell window Select Shell window close gadget
FORMAT Format a disk Format Disk menu item
INFO Show information on all disks Observe disk window title bars

AmigaDOS Command Structure

Every AmigaDOS command has a specific format and syntax that must be used for the system to accept and act on the command. The general rules for working with AmigaDOS commands are few, but absolute:

  • A legal command or program name must appear first on the command line. The full path to the command is not necessary if the command is in a directory on the search path.
  • Arguments are separated from the command and from each other by spaces; a single space is sufficient, but additional spaces are allowed. No punctuation, other than that specifically needed in the command, should be used.
  • AmigaDOS is not case-sensitive. Any mixture of upper and lower case can be used on the command line, however, case is ignored. Capitalization given in file and directory names is preserved.
  • Except where noted, when a path or string argument contains a space, the entire path or string must be enclosed in double quotation marks ("). For example:
1> ECHO command TO Adisk:Text/Comment
1> ECHO "A comment" TO "My Disk:Text/Comment"
  • The maximum length of a standard Shell command line is 512 characters.

A sample of the structure of an AmigaDOS command line is illustrated in Figure 3-3. It consists of the COPY command followed by two arguments.

Figure 3-3. Example Command Line

An argument is an additional piece of information the command uses, such as a file name or option. Command arguments are similar to icon Tool Types on the Workbench. Depending on the command, arguments can be optional ir required. Figure 3-3 illustrates the following points about arguments.

  • Keywords for AmigaDOS commands are generally full words or simple abbreviations, in this example, FROM and TO.
  • An argument can consist of more than one term; in the example, a file name argument accepts two names at the same time: Screenmode and Screenmode.info.
  • Some arguments have an identifying keyword, which can be optional or required.
  • When optional keywords are omitted in a multiple-argument command, the arguments must appear in the order shown by the command template.

Special AmigaDOS Characters

There are several characters that have special meanings when used in AmigaDOS. The functions of special characters include the following:

  • Specifying paths
  • Pattern matching
  • Redirecting command input and output

It is important when using AmigaDOS to remember the various special functions that characters can have. Note that in different contexts the same character can have different effects or have no special effect. If a command that appears correct produces unexpected results, check to see if any character in the command has a special function.