Topic of today's lecture: I/O redirection and inheritance. Shell quoting. Filesystem structure; device files; mounting filesystems.
Shell quoting: backslash (\) escapes the special meaning of the next character, and may be used to prevent both globbing and dollar expansion (i.e., using the backslash to escape the globbing metacharacters and dollar signs); all text quoted by single quotes lose their special meaning, including backslash, double quotes, globbing metacharacters, and dollar signs; text quoted by double quotes are not globbed, but are dollar-expanded.
The filesystem in Unix is a tree, where each internal node is a directory and the leaf nodes are files. Every disk drive containing a filesystem has such a tree; when a drive is added, it is mounted onto the existing filesystem tree -- what this means is that the root of the tree from the new drive replaces a directory in the existing tree, so the command
$ mount /dev/sd2a /usr2mounts the disk device /dev/sd2a onto the current tree so that all future references to /usr2 will actually refer to the root of the tree from the disk /dev/sd2a instead. The original contents of the directory /usr2 becomes invisible after the mount operation (usually these `mount points' are empty directories anyway).
The name /dev/sd2a above is the name of a device file. A device file is an entry in the filesystem name space referring to a hardware device. In most Unix filesystems, the convention is that device files are all in the /dev directory, though Solaris uses /devices and /dev both. By making hardware devices appear as files, many standard utility programs may be used with hardware devices without special modification by I/O redirection or by using the device file names as parameters.
Next time: Magic numbers; executables and shell scripts.
bsy@cse.ucsd.edu, last updated