Shell quoting cheat sheet

Acorn paths use $, ., :, *, #, !, and ^ — nearly every one of which is special in at least one mainstream shell. This page documents the safe quoting form per shell so other pages can show a canonical example and link here for the platform- specific tweaks.

The shell tabs below auto-select based on your operating system on first visit. You can switch tabs manually and the choice is remembered across pages.

Characters to watch

Character

Role in Acorn paths

Shell trouble

$

Root directory ($.DIR.FILE)

Variable / parameter expansion in bash, zsh, PowerShell (in double quotes)

:

OUTER_PATH:INNER_PATH separator; adfs: / afs: / acorn-dfs: partition selectors

Inside double quotes on PowerShell it is interpreted as a drive-name separator in some contexts; otherwise harmless

.

In-image component separator

Harmless on POSIX shells; harmless on PowerShell

*

Star-aliases (*CAT); wildcards (any sequence)

Glob expansion in bash, zsh, PowerShell, cmd

#

Wildcard (single character)

Start-of-line comment in bash, zsh; harmless mid-token

!

Common in file names (!BOOT, !Run)

History expansion in zsh and (with histexpand on) bash; harmless in PowerShell

^

Parent directory

Pipe symbol in zsh extendedglob; escape character in cmd.exe

The single safest rule is to wrap the whole INNER_PATH (and the COMPOUND_PATH if you can stand it) in single quotes on POSIX shells and single quotes on PowerShell — that suppresses expansion across the board. The examples below use that convention.

Keep $, !, and * literal

Acorn root-directory references ($.PATH), boot files (!BOOT), and star-aliases (*CAT) all collide with shell metacharacters.

disc cat 'image.dat:$.!BOOT'     # single quotes: every char literal
disc \*CAT image.dat              # backslash-escape the *
disc '*CAT' image.dat             # or single-quote the *
# zsh expands history references inside double quotes, so
# $.!BOOT needs single quotes. Bash does the same when
# histexpand is on (it isn't by default for non-interactive
# bash, but it is in most interactive sessions).
disc cat 'image.dat:$.!BOOT'
disc '*CAT' image.dat
# PowerShell treats $ as a variable prefix inside double
# quotes, so use single quotes to keep $.!BOOT literal.
disc cat 'image.dat:$.!BOOT'
disc '*CAT' image.dat

Wildcards: stop the shell expanding first

Acorn wildcards (*, #) need to reach disc intact. If you let the shell expand them, disc sees whatever files the shell matched in the host’s current directory — almost never what you meant.

disc find 'image.adl:$.Games.*'
disc find 'image.adl:S####'
# zsh treats # at the start of a word as a comment unless
# interactive_comments is off — single-quote the whole arg
# to be safe.
disc find 'image.adl:$.Games.*'
disc find 'image.adl:S####'
disc find 'image.adl:$.Games.*'
disc find 'image.adl:S####'

Pass a single $.PATH argument

When you just want one literal in-image path, the same single-quote rule applies. The convention used throughout this manual.

disc ls 'image.dat:$.DIR.FILE'
disc cat 'image.dat:$.HELLO'
disc ls 'image.dat:$.DIR.FILE'
disc cat 'image.dat:$.HELLO'
disc ls 'image.dat:$.DIR.FILE'
disc cat 'image.dat:$.HELLO'

When you need double quotes

Double quotes are useful when part of the argument is a shell variable you do want expanded — most often the image filename held in a script variable. Mix the two quoting styles so the variable expands and the literal part stays literal.

IMAGE=scsi0.dat
disc ls "$IMAGE":'$.Library'        # $IMAGE expands, $.Library literal
disc ls "${IMAGE}:\$.Library"       # alternative: escape the $
IMAGE=scsi0.dat
disc ls "$IMAGE":'$.Library'
disc ls "${IMAGE}:\$.Library"
$image = 'scsi0.dat'
disc ls "${image}:`$.Library"       # backtick-escape the $

Windows paths and POSIX shells

A Windows path written into a Bash or Zsh script needs its backslashes escaped (or single-quoted), and the trailing :INNER_PATH still works as written.

disc ls 'C:\Discs\disc.dat:$.HELLO'
disc ls 'C:\Discs\disc.dat:$.HELLO'