Table of Contents

AmigaDOS Command Reference

Copy two Disks

In AmigaDOS, this can be performed with:

copy DH0: to DH1: all clone

where:

Launch a Background Task

Background tasks can be launched using the run command. Multiple commands can be specified on different lines by using the + character as separator.

The following example:

run join text1 text2 as text+
sort text to sorted+
type sorted to PRT:

will perform the following actions, in order:

  1. join the text files text1 and text2 in text,
  2. sort the resulting text file in sorted,
  3. type all the characters from sorted to the printer device PRT:.

Input and Output Redirection

The < and > characters can be used to redirect standard input, respectively standard output. On OS 1.x, the > operator must immediately follow the command. For example:

echo >greeting.txt "Good day!"

will create a file greeting.txt containing Good day!.

Command Interruption

The following keys can be used to interrupt commands and scripts:

Combo Description
Ctrl+C Interrupts the current command.
Ctrl+D Interrupts a script after the current executing command.

Create a Bootable Floppy Drive

First format the drive with:

format drive DF0: name "Boot"

and then make it bootable with:

install DF0:

Wildcards

The following wildcards are supported:

Wildcard Meaning
? Any character.
# Zero or more characters equal to the next one.
| The preceding or following string.
% The empty string.
[] Any of the characters inside the brackets.
- A range of characters, eg: 0-9A-Za-z.
~ Any string or character sequence except the following.
() The string inside the brackets.
Escape character.

Based on the previous, the following command:

delete #?

reads: "match zero of more characters (#) of any character (?)" and will delete all the files in the current directory.

Escape Sequences

The Esc key, or the shortcut Ctrl+[, or the expression *e will insert in the current output an escape character (code 27 octal or 0x1B hexadecimal) which can then be used to insert ANSI sequences and Amiga sequences:

Sequence Meaning
*ec Reset console window to the default.
*eD Line feed.
*eE Line feed and carriage return.
*e[0m Reset graphics modes to default.
*e[1m Bold.
*e[22m Undo bold.
*e[3m Italic.
*e[23m Undo italic.
*e[4m Underline.
*e[24m Undo underline.
*e[7m Reverse text and back colour.
*e[27m Undo reverse.

Console Shortcuts

Shortcut Meaning
Ctrl+X Clear current row.
Esc+C Clear screen.
Shift+ Shift+ Go to the previous, respectively next, word or go to the line beginning or end (depending on the shell).
Ctrl+\ Insert an end of line character.

Output scrolling can be paused by typing any character and the continued by deleting that character.

Filesystem Conventions

Loops

Loops are not built-in but they can be created artificially using variables and control-flow instructions or by using pipes.

Using Environment Variables

This is syntactically equivalent to a do-while loop as the loop condition is checked at the end of the loop and the operations (Echo in this case) are performed before checking the loop condition.

SetEnv >NIL: i 10                          ; Set the loop variable "ENV:i" to 10
Lab start                                  ; Label the start of the loop
Echo $i                                    ; Display the contents of the variable "ENV:i"
Eval <ENV:i >NIL: VALUE2=1 OP=- To=T:i ?   ; Evaluate by reading from the
                                           ; environment variable "ENV:i" and the value "1"
                                           ; setting the operation to "-" and
                                           ; storing the result in the temporary variable "T:i"
SetEnv >NIL: i <T:i ?                      ; Set the environment variable "ENV:i" to
                                           ; the newly evaluated temporary variable "T:i"
If Val $i Gt 0                             ; If the value of "$i" is greater than 0
	Skip start Back                    ; Jump back to the "start" label
EndIf
Delete ENV:i T:i Quiet                     ; Otherwise, delete the environment variable "ENV:i"
                                           ; and the temporary variable "T:i" while being quiet
Echo "Done"                                ; Finally, print "Done"

Shell Script to Sort Directories and Files Into Alpha-Numeric Directories

This is a simple AmigaDOS script that can sort directories into alpha-numeric directories by the first letter or number of each file or directory. That is, given a tree such as:

     +
     |
     +-abcd
     |   |
     |   +-file
     |   +-za
     |
     +-mpq
     |
     +-pictures
          |
          +-qier
             |
             +-apqb

it will sort all the top level files and directories resulting in the following tree:

+-0-9
+-A
| |
| +-abcd
|     |
|     +-file
|     +-za
+-B
+-C
+-D
+-E
+-F
+-G
+-H
+-I
+-J
+-K
+-L
+-M
| |
| +-mpq
|
+-N
+-O
+-P
| |
| +-pictures
|      |
+-Q    +-qier
+-R       |
+-S       +-apqb
+-T
+-U
+-V
+-W
+-X
+-Y
+-Z

The script is pure AmigaDOS and does not require any external tools.

sortanum
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3      ;;
;;  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  ;;
;;  rights of fair usage, the disclaimer and warranty conditions.        ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; Suppress errors
FailAt 21 
 
; Move 0-9
List QUICK NOHEAD [0-9]#? To PIPE:0-9 LFORMAT="Rename %n 0-9/ Quiet"
If Not Exists "0-9"
	MakeDir "0-9"
EndIf
Execute PIPE:0-9
 
; Move A,a
List QUICK NOHEAD [A,a]#? To PIPE:MoveA LFORMAT="Rename %n A/ Quiet"
If Not Exists "A"
	MakeDir "A"
EndIf
Execute PIPE:MoveA
 
; Move B,b
List QUICK NOHEAD [B,b]#? To PIPE:MoveB LFORMAT="Rename %n B/ Quiet"
If Not Exists "B"
	MakeDir "B"
EndIf
Execute PIPE:MoveB
 
; Move C,c
List QUICK NOHEAD [C,c]#? To PIPE:MoveC LFORMAT="Rename %n C/ Quiet"
If Not Exists "C"
	MakeDir "C"
EndIf
Execute PIPE:MoveC
 
; Move D,d
List QUICK NOHEAD [D,d]#? To PIPE:MoveD LFORMAT="Rename %n D/ Quiet"
If Not Exists "D"
	MakeDir "D"
EndIf
Execute PIPE:MoveD
 
; Move E,e
List QUICK NOHEAD [E,e]#? To PIPE:MoveE LFORMAT="Rename %n E/ Quiet"
If Not Exists "E"
	MakeDir "E"
EndIf
Execute PIPE:MoveE
 
; Move F,f
List QUICK NOHEAD [F,f]#? To PIPE:MoveF LFORMAT="Rename %n F/ Quiet"
If Not Exists "F"
	MakeDir "F"
EndIf
Execute PIPE:MoveF
 
; Move G,g
List QUICK NOHEAD [G,g]#? To PIPE:MoveG LFORMAT="Rename %n G/ Quiet"
If Not Exists "G"
	MakeDir "G"
EndIf
Execute PIPE:MoveG
 
; Move H,h
List QUICK NOHEAD [H,h]#? To PIPE:MoveH LFORMAT="Rename %n H/ Quiet"
If Not Exists "H"
	MakeDir "H"
EndIf
Execute PIPE:MoveH
 
; Move I,i
List QUICK NOHEAD [I,i]#? To PIPE:MoveI LFORMAT="Rename %n I/ Quiet"
If Not Exists "I"
	MakeDir "I"
EndIf
Execute PIPE:MoveI
 
; Move J,j
List QUICK NOHEAD [J,j]#? To PIPE:MoveJ LFORMAT="Rename %n J/ Quiet"
If Not Exists "J"
	MakeDir "J"
EndIf
Execute PIPE:MoveJ
 
; Move K,k
List QUICK NOHEAD [K,k]#? To PIPE:MoveK LFORMAT="Rename %n K/ Quiet"
If Not Exists "K"
	MakeDir "K"
EndIf
Execute PIPE:MoveK
 
; Move L,l
List QUICK NOHEAD [L,l]#? To PIPE:MoveL LFORMAT="Rename %n L/ Quiet"
If Not Exists "L"
	MakeDir "L"
EndIf
Execute PIPE:MoveL
 
; Move M,m
List QUICK NOHEAD [M,m]#? To PIPE:MoveM LFORMAT="Rename %n M/ Quiet"
If Not Exists "M"
	MakeDir "M"
EndIf
Execute PIPE:MoveM
 
; Move N,n
List QUICK NOHEAD [N,n]#? To PIPE:MoveN LFORMAT="Rename %n N/ Quiet"
If Not Exists "N"
	MakeDir "N"
EndIf
Execute PIPE:MoveN
 
; Move O,o
List QUICK NOHEAD [O,o]#? To PIPE:MoveO LFORMAT="Rename %n O/ Quiet"
If Not Exists "O"
	MakeDir "O"
EndIf
Execute PIPE:MoveO
 
; Move P,p
List QUICK NOHEAD [P,p]#? To PIPE:MoveP LFORMAT="Rename %n P/ Quiet"
If Not Exists "P"
	MakeDir "P"
EndIf
Execute PIPE:MoveP
 
; Move Q,q
List QUICK NOHEAD [Q,q]#? To PIPE:MoveQ LFORMAT="Rename %n Q/ Quiet"
If Not Exists "Q"
	MakeDir "Q"
EndIf
Execute PIPE:MoveQ
 
; Move R,r
List QUICK NOHEAD [R,r]#? To PIPE:MoveR LFORMAT="Rename %n R/ Quiet"
If Not Exists "R"
	MakeDir "R"
EndIf
Execute PIPE:MoveR
 
; Move S,s
List QUICK NOHEAD [S,s]#? To PIPE:MoveS LFORMAT="Rename %n S/ Quiet"
If Not Exists "S"
	MakeDir "S"
EndIf
Execute PIPE:MoveS
 
; Move T,t
List QUICK NOHEAD [T,t]#? To PIPE:MoveT LFORMAT="Rename %n T/ Quiet"
If Not Exists "T"
	MakeDir "T"
EndIf
Execute PIPE:MoveT
 
; Move U,u
List QUICK NOHEAD [U,u]#? To PIPE:MoveU LFORMAT="Rename %n U/ Quiet"
If Not Exists "U"
	MakeDir "U"
EndIf
Execute PIPE:MoveU
 
; Move V,v
List QUICK NOHEAD [V,v]#? To PIPE:MoveV LFORMAT="Rename %n V/ Quiet"
If Not Exists "V"
	MakeDir "V"
EndIf
Execute PIPE:MoveV
 
; Move W,w
List QUICK NOHEAD [W,w]#? To PIPE:MoveW LFORMAT="Rename %n W/ Quiet"
If Not Exists "W"
	MakeDir "W"
EndIf
Execute PIPE:MoveW
 
; Move X,x
List QUICK NOHEAD [X,x]#? To PIPE:MoveX LFORMAT="Rename %n X/ Quiet"
If Not Exists "X"
	MakeDir "X"
EndIf
Execute PIPE:MoveX
 
; Move Y,y
List QUICK NOHEAD [Y,y]#? To PIPE:MoveY LFORMAT="Rename %n Y/ Quiet"
If Not Exists "Y"
	MakeDir "Y"
EndIf
Execute PIPE:MoveY
 
; Move Z,z
List QUICK NOHEAD [Z,z]#? To PIPE:MoveZ LFORMAT="Rename %n Z/ Quiet"
If Not Exists "Z"
	MakeDir "Z"
EndIf
Execute PIPE:MoveZ