This is a cache of https://vccplus.brianholman.com/manuals/working-with-os9/procedure/. It is a snapshot of the page as it appeared on 2026-11-21T00:01:40.158+0000.
Give the shell a job · Working with OS-9 — A Comprehensive Manual · VCC Plus
← Manual LibraryVCC Plus 3.7.1 · Reading on the web

Try the exercises in VCC Plus. Example links download files here; open them in the app to work beside the emulator.

The complete book · PDF editionBook 11: Working with OS-9 — A Comprehensive Manual

51 pages · VCC Plus 3.7.1 · Keep a copy to read or print.

Download PDF
Contents

Chapter 2 of 14

Give the shell a job

A station operator can remember two commands. A relief operator arriving tomorrow would appreciate finding them already written down. Give the next shift a file that the shell itself can read.

Write and inspect a procedure

Start in /H1/station, the data directory created in chapter 1. Enter build report. The ? belongs to Build. Type each of the following lines, pressing Return after each. At the next empty ? press Return once more. That blank reply ends entry.

echo beacon online
pwd

Now enter the following at Shell+:

list report
shell report

list displays the two command lines exactly as stored. shell report interprets those lines and displays beacon online followed by /H1/station. The first word on the outer command line names a program. The word report is an argument to it. Inside the file, echo receives the words beacon online. The second command, pwd, uses the directory inherited from the calling environment.

Notice what the procedure leaves behind. You are back at the prompt that started it, still standing in the station directory. A child shell can change its own working directory while running a job. Its parent retains its own directory when the child exits.

See which punctuation the shell handles

Enter these two lines separately:

(echo north; echo south)
echo "two words"

The first prints north, then south. The semicolon separates commands that run in sequence. The parentheses group that sequence. The second line prints "two words", complete with quotes. The quotes survive in the parameter text seen by this version of Echo. This matters to a reader coming from a Mac shell, where the output of the same-looking command can differ.

At the OS level, the new program receives a parameter area containing text. Each utility has rules for interpreting that text. Consider the different jobs of shell report, list report and echo report. The same word can name a procedure, name a file to display, or simply be part of a message. Use each utility’s own syntax when an argument can contain a space.

Let the child read until the file ends

Try another way to supply those two lines:

shell <report

This time an interactive copy of Shell+ receives the file on its standard input. In the practice session it printed its greeting, ran both commands, displayed eof, and returned to the original shell. The terminal and process number in the child’s prompt help identify the change. The child stops because the file has no more input. Nothing in the file needs to type an exit command.

Programs also return a completion status. A child can finish successfully or give its caller an error number. Output text and completion status are separate ways to report what happened. In the next chapter a failing child’s message will travel down a path you choose. Later you will write a module that chooses its own exit status.

Original VCC Plus manuals © 2026 Brian K. Holman. Third-party references retain their authors’ copyrights and licenses. Artwork notices. Edition 3.7.1; source and export identity. Printable edition: PDF source and export identity.

A closer look

Open original