Chapter 2. The Plash shell

Table of Contents

Overview of differences from Bash
Bourne shell features missing from Plash
Installation endowment
Enabling access to the X11 Window System
Job control
Shell scripts

Overview of differences from Bash

The syntax of Plash is similar to Unix shells such as the Bourne shell or Bash. Here are some examples of command invocations using Plash:

ls .

Arguments that were implicit before must now be made explicit. With the Bourne shell or Bash you can write `ls' to list the current directory's contents. With Plash you must add `.' to grant access to the current directory.

gcc -c foo.c => -o foo.o

Files are passed to the program as read-only by default. Adding the `=>' operator to a command invocation allows you to grant write access to a file. Files that appear to the right of `=>' are passed to the program with write access.

Directories to the left of `=>' will be passed as *recursive* (or *transitive*) read-only: files and directories that they contain will also be read-only.

make + => .

If you want to grant access to a file or directory without passing the filename as an argument, you can use the `+' operator. Files that appear to the right of a `+' are attached to the namespace of the process being run, but the filename is not included in the argument list.

The `=>' operator binds more tightly than `+'.

echo "Hello, world!"

The shell distinguishes between filename arguments and plain string arguments so that it can tell which files to grant access to. Arguments beginning with a hyphen (`-') are interpreted as plain strings, but otherwise you must quote arguments to prevent them from being interpreted as filenames.

tar -cvzf { => foo.tar.gz } dir1

If you want to put a read-write file before a file that should only be read-only in the argument list, you can limit the scope of the `=>' operator by enclosing arguments in curly brackets { ... }.

xclock + ~/.Xauthority => /tmp/.X11-unix

You can run X Windows programs if you give them access to ~/.Xauthority, which contains a password generated by the X server, and /tmp/.X11-unix, which contains the socket for connecting to the X server. Programs must be given write access to a socket in order to connect to it.

grep 'pattern' file | less

Pipes work as in conventional shells.

!!bash

If you want to execute a command in the conventional way, without running the process with a virtualised filesystem, in a chroot jail, etc., you can prefix it with "!!". This can be applied to individual command invocations in a pipeline. The syntax for command invocations is the same whether "!!" is used or not, but when it is used, files listed after the "+" operator are ignored.

cd directory

Changing directory works as before.