RISC OS Open
Safeguarding the past, present and future of RISC OS for everyone
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

CLI Basics part 3

<< Part 2 | Index ^^ | Part 4 >>


Wildcards

Several commands (including *Copy) allow you to specify more than one file by using a wildcard in the filename. The available wildcards are:

* Match 0 or more characters
# Match one character

For example:
Fred* would match “Fred”, “Freddy”, “Freda” and “Frederick”;
Fred# would match “Freda” but not “Fred”, “Freddy” or “Frederick”;
Fred## would match “Freddy” but not “Fred”, “Freda” or “Frederick”.

 

System devices

RISC OS contains a number of system devices, which can be used in place of filenames if you want to send (or receive) data to/from somewhere other than a file:

kbd: The keyboard, reading a line at a time
rawkbd: The keyboard, reading a character at a time
vdu: The screen
rawvdu: The screen, bypassing GSRead conversion
serial: The serial port
printer: The printer
null: The null device, which discards all output

For example, you can use the *Copy command to send a file to the printer:
*Copy MyFile printer:

Alternatively, you may want to run a command but are not interested in any screen output. This can be done by redirecting output to the null device:
*MyCommand { > null: }

For a full list of system devices, see SystemDevices Technical Details.

 

Filetype declarations

Command aliases were mentioned in part 2. Another special type of alias is used to declare the default action to be taken on encountering a filetype. These take the following forms:

Alias$LoadType_XXX Specifies the action to be taken when a file of type XXX (in hexadecimal) is loaded
Alias$RunType_XXX Specifies the action to be taken when a file of type XXX is run

Most of these declarations are only of use in the desktop, but a handful are also relevant while in the CLI. For example, the default settings for filetype FFE are:
Alias$RunType_FFE Exec %0
which means that, if a file of type FFE is entered as a command at the star prompt, the action taken will be to *Exec the file.

 

System path variables

The way RISC OS searches for files or commands is controlled by the system variables File$Path and RunPath, as follows:

File$Path The list of directories that RISC OS searches when looking for a file.
Run$Path The list of directories that RISC OS searches when looking for a program to run.

Each entry in the path contains a directory name followed by a full stop. Entries are separated by commas; two commas in a row are treated as a null entry (i.e. the currently selected directory, also known as CSD). Hence a run path of Boot:Library.,,%. would cause “Boot:Library” to be searched first, followed by CSD and finally “%” (i.e. the current library directory).

There are occasions when you may want to change these settings. For example, if you wanted RISC OS to search $.MyLibrary in addition to the other directories in Run$Path, you might use:
*Set Run$Path <Run$Path>,$.MyLibrary.

For more information on File$Path and Run$Path, see FileSwitch Paths To Search For Files.

 

Further reading

  • System Variables in the Programmer’s Reference Manual.

<< Part 2 | Index ^^ | Part 4 >>

Revised on February 1, 2021 10:00:47 by Stuart Painting (5389)? (2.30.134.243)
Edit | Back in time (1 revision) | See changes | History | Views: Print | Source | Linked from: CLI Basics part 4, CLI Basics, CLI Basics part 2

Search the Wiki

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys