Sams Teach Yourself Shell Programming in 24 Hours
(Publisher: Macmillan Computer Publishing)
Author(s): Sriranga Veeraraghavan
ISBN: 0672314819
Publication Date: 01/01/99
Appendix B
Glossary
- absolute path
- The complete pathname to a file starting at the root directory /.
- abstraction
- Scripts that use abstraction retain the same basic flow by placing the conditional execution statements within functions. When a function is called, it makes a decision as to what commands execute for a given platform.
- anchoring expression
- Normally any part of a line will be matched by a regular expression. To match expressions that either begin or end a line, you need to anchor the regular expression. The ^ character anchors regular expressions to the beginning of a line, whereas the $ character anchors regular expressions to the end of a line.
- argument
- Command modifiers that change the behavior of a command. In the shell, they are specified after a commands name.
- array variable
- A mechanism available in bash and ksh for grouping scalar variables together. The scalar variables stored in an array are accessed using a single name in conjunction with a number. This number is referred to as an index.
- awk
- The awk command is a power pattern matching language that allows you to modify input lines by manipulating the fields they contain.
- background
- Processes usually running at a lower priority and with their input disconnected from the interactive session. Any input and output are usually directed to a file or other process.
- background process
- An autonomous process that runs under UNIX without requiring user interaction.
- bash
- Stands for GNU Bourne Again shell and is based on the Bourne shell, sh, the original command interpreter.
- block special file
- Provides a mechanism for communicating with device drivers via the file system. These files are called block devices because they transfer large blocks of data at a time. This type of file typically represents hard drives and removable media.
- body
- The set of commands executed by a loop is called the body of the loop.
- Bourne shell
- The original standard user interface to UNIX that supported limited programming capability.
- BSD
- Berkeley Software Distribution.
- BSD UNIX
- Version of UNIX developed by Berkeley Software Distribution and written at the University of California, Berkeley.
- built in
- A command whose code is part of the shell as opposed to a utility that exists in a separate disk file, which must be read into memory before executing the command.
- C shell
- A user interface for UNIX written by Bill Joy at Berkeley. It features C-programming-like syntax.
- cat
- The command used to view the contents of a file.
- cd
- The command used to change directories.
- character special file
- Character special files provide a mechanism for communicating with a device one character at a time.
- child process
- See subprocess.
- child shell
- See subshell.
- chown
- The command used to change the owner of a file or directory.
- command
- The name of a program and any arguments you specify to that program to cause its behavior to change. You might see the term command used instead of the term utility for simple commands, where only the program name to execute is given.
- command separator
- Indicates where one command ends and another begins. The most common command separator is the semicolon character, ;.
- command substitution
- The process by which the shell executes a command and substitutes in the output of the command.
- comment
- A statement that is embedded in a shell script but should not be executed by the shell.
- complex command
- A command that consists of a command name and a list of arguments.
- compound command
- A list of simple and complex commands separated by the semicolon character, ;.
- compound expression
- Consists of one or more expressions.
- conditional execution
- Alters the execution of a script, based on the system type. A script that uses conditional execution usually consists of an if statement at the beginning that sets variables to indicate the commands that should be used on a particular platform.
- cp
- The command used to copy files.
- daemon
- A system-related background process that often runs with the permissions of root and services requests from other processes.
- debugging hook
- A function or set of commands that executes only when a shell script executes with a special argument. Debugging hooks provide a convenient method for tracing the execution of a script in order to fix problems.
- default behavior
- The output that is generated when a command runs as a simple command is called the default behavior of that command.
- directory
- A type of file used to store other files. For users familiar with Windows or Mac OS, UNIX directories are equivalent to folders.
- directory tree
- UNIX uses a hierarchical structure for organizing files and directories. This structure is often referred to as a directory tree. The tree has a single root node, the slash character (/), and all other directories are contained below it.
- environment variable
- A variable that is available to any program that is started by the shell.
- escape sequence
- A special sequence of characters that represents another character.
- escaping
- Escaping a character means to put a backslash (\) just before that character. Escaping can either remove the special meaning of a character in a shell command or it can add special meaning as we saw with \n in the echo command. The character following the backslash is called an escaped character.
- execute permission
- In UNIX, only those files that have execute permission enabled can run.
- exporting
- A variable is placed in the environment by exporting it using the export command.
- expression
- A piece of code that are evaluated to produce a numeric result, such as 0 or 1. Some expressions that involve mathematical operations can produce other results.
- field
- A set of characters that are separated by one or more field separator characters. The default field separator characters are Tab and Space.
- field separator
- Controls the manner in which an input line is broken into fields. In the shell, the field separator is stored in the variable IFS. In awk the field separator is stored in the awk variable FS. Both the shell and awk use the default value of Space and Tab for the field separator.
- file descriptor
- An integer that is associated with a file. Allows you to read and write from a file using the integer instead of the filename.
- filesystem
- A directory structure contained within a disk drive or disk area. The total available disk space can be composed of one or more filesystems. A filesystem must be mounted before it can be accessed. To mount a filesystem, you must specify a directory to act as the mount point. Once mounted, any access to the mount point directory or its subdirectories will access the separate filesystem.
- hard link
- A directory entry which maps a filename to an inode number. A file may have multiple names or hard links. The link count gives the number of names by which a file is accessible. Hard links do not allow multiple names for directories and do not allow multiple names in different filesystems.
- home directory
- Your home directory is the directory that you start out in after you log in.
- infinite loop
- A loop that executes forever without terminating.
- inode
- A table entry within a filesystem that contains file information such as the owner, group, permissions, last modification date/time, last access date/time, and the block list of the actual file data. There is one inode for each file. The inodes are numbered sequentially. The inode does not contain the filename. A directory is a table that maps filenames to inode numbers.
- input redirection
- In UNIX, the process of sending input to a command from a file.
- interactive mode
- In interactive mode, the shell reads input from you and executes the commands that you specify. This mode is called interactive because the shell is interacting with a user.
- invisible or hidden file
- A file whose name starts with the . character. By default the ls command does not list these files. You can list them by specifying the -a option to ls.
- iteration
- A single execution of the body of a loop.
- kernel
- The heart of the UNIX system. It provides utilities with a means of accessing a machines hardware. It also handles the scheduling and execution of commands.
- Korn shell
- A user interface for UNIX with extensive scripting (programming) support. Written by David G. Korn. The shell features command-line editing and will also accept scripts written for the Bourne shell.
- library
- A file that contains only functions. Usually libraries contain no main code.
- literal character
- A character with no special meaning and which causes no extra action to be taken. Quoting causes the shell to treat a wildcard as a literal character.
- local variable
- A variable that is present within the current instance of the shell. It is not available to programs that are started by the shell.
- loop
- Enables you to execute a series of commands multiple times. Two main types of loops are the while and for loops.
- ls
- The command used to list the files in a directory.
- main code
- Consists of all the commands in a shell script that are not contained within functions.
- major number
- UNIX uses this to associate a block special file or a character special file with a device driver.
- man page
- Every version of UNIX comes with an extensive collection of online help pages called man pages (short for manual pages). The man pages are the authoritative source about your UNIX system. They contain complete information about both the kernel and all the utilities.
- metacharacter
- In a regular expressions, a metacharacter is a special character that is expanded to match patterns.
- minor number
- UNIX uses this to associate a block special file or a character special file with a device driver.
- modulus function
- See remainder function.
- mv
- The command used to rename files.
- nested loop
- When a loop is located inside the body of another loop it is said to be nested within another loop.
- newline character
- Literally the linefeed character whose ASCII value is 10. In general, the newline character is a special shell character that indicates a complete command line has been entered and it may now be executed.
- no-op
- A command that does nothing and thus can be used as a dummy command or placeholder where syntax requires a command.
- noninteractive mode
- In noninteractive mode, the shell does not interact with you, rather it reads commands stored in a file and executes them. When it reaches the end of the file, the shell exits.
- numeric expression
- A command used to add, subtract, multiply, and divide two numbers. Numeric expressions are constructed using the numeric operators+ (add), (subtract), * (multiply), and / (divide).
- ordinary file
- A file on the system that contains data, text, or program instructions.
- output redirection
- In UNIX the process of capturing the output of a command and storing it in a file is called output redirection, because it redirects the output of a command into a file instead of the screen.
- parent process
- Process that controls another often referred to as the child process or subprocess. See process.
- parent process identifier
- Shown in the heading of the ps command as PPID. The process identifier of the parent process. See also parent process.
- parent shell
- Shell (typically the login shell) that controls another, often referred to as the child shell or subshell. See shell.
- piping
- The process used to redirect the output of one command into the input of another command. Piping is accomplished with the pipe character, |.
- process
- A discrete running program under UNIX. The users interactive session is a process. A process can invoke (run) and control another program that is then referred to as a subprocess. Ultimately, everything a user does is a subprocess of the operating system.
- process identifier
- Shown in the heading of the ps command as pid. The unique number assigned to every process running in the system.
- prompt
- When you see a prompt, you can type the name of a command and press Enter. In this book, we will use the $ character to indicate the prompt.
- PS2 variable
- A shell variable whose content is usually the > character. The contents of the PS2 variable is displayed by the shell as a secondary prompt that indicates the previous command was not complete and the current command line is a continuation of that command line.
- pwd
- The pwd command prints the absolute path of the current directory.
- quoting
- Literally, to enclose selected text within some type of quotation marks. When applied to shell commands, quoting means to disable shell interpretation of special characters by enclosing the character within single or double quotes or by escaping the character.
- read permission
- The read permission of a file or directory determines which users can view the contents of that file or directory.
- regular expression
- A string that can describe several sequences of characters.
- regular file
- The most common type of files you will encounter. These files store any kind of data. This data may be stored in plain text, an application-specific format, or a special binary format that the system can execute.
- relative path
- Relative pathnames let you access files and directories by specifying a path to that file or directory relative to your current directory.
- remainder function
- The remainder of a division operation, which is the amount that is left over and thus not evenly divisible.
- reserved word
- A nonquoted word that is used in grouping commands or selectively executing them, such as: if, then, else, elif, fi, case, esac, for, while, until, do, or done.
- rm
- The command used to remove files.
- scalar variable
- A scalar variable can hold only one value at a time.
- sed
- The sed command is a stream editor that allows you to modify input lines using regular expressions.
- set group ID (SGID)
- The SGID permission causes a script to run with its group set to the group of the script, rather than the group of the user who started it.
- set user ID (SUID)
- The SUID permission causes a script to run as the user who is the owner of the script, rather than the user who started it.
- shell
- Provides you with an interface to the UNIX system. It gathers input from you and executes programs based on that input. After a program has finished executing, the shell displays that programs output. The shell is sometimes called a command interpreter. See also bash, Bourne shell, C shell, Korn shell, and tcsh.
- shell initialization
- After a shell is started it undergoes a phase called initialization to set up some important parameters. This is usually a two step process that involves the shell reading the files /etc/profile and .profile.
- shell or command prompt
- The single character or set of characters that the UNIX shell displays for which a user can enter a command or set of commands.
- shell preprocessing
- This describes actions taken by the shell to manipulate the command line before executing it. This is when filename, variable, command, and arithmetic substitution occur (as covered in Chapter 8, Substitution).
- shell script
- A program written using a shell programming language like those supported by Bourne, Korn, or C shells. In general, a script contains a list of commands that are executed noninteractively by the shell.
- shell variable
- A special variable that is set by the shell and is required by the shell in order function correctly.
- signal
- Software interrupts sent to a program to indicate that an important event has occurred. The events can vary from user requests to illegal memory access errors. Some signals, like the interrupt signal, indicate that a user has asked the program to do something that is not in the usual flow of control.
- signal handler
- A function that executes when a signal is received by a shell script. Usually signal handlers clean up temporary files and then exit.
- simple command
- A simple command is a command that you can execute by just giving its name at the prompt.
- socket file
- A special file for interacting with the network via the UNIX file system.
- STDERR
- Standard error. A special type of output used for error messages. The file descriptor for STDERR is 2.
- STDIN
- Standard input. User input is read from STDIN. The file descriptor for STDIN is 0.
- STDOUT
- Standard output. The output of scripts is usually to STDOUT. The file descriptor for STDOUT is 1.
- subdirectory
- A directory that is contained within another directory.
- subprocess
- Process running under the control of another, often referred to as the parent process. See process.
- subshell
- Shell running under the control of another, often referred to as the parent shell (typically the login shell). See shell.
- symbolic link or soft link
- A special filetype which is a small pointer file allowing multiple names for the same file. Unlike hard links, symbolic links can be made for directories and can be made across filesystems. Commands that access the file being pointed to are said to follow the symbolic link. Commands that access the link itself do not follow the symbolic link.
- system call
- A C language function that is used to request services from the UNIX kernel.
- tcsh
- A C shelllike user interface featuring command-line editing.
- uninitialized shell
- When a shell is started it is uninitialized. This means that important parameters required by the shell to function correctly are not defined.
- usage statement
- A statement issued by a shell script when one or more of its arguments are improperly specified.
- utility
- Utilities are programs, such as who and date, you can run or execute.
- variable substitution
- The process used by the shell to substitute the value of a variable, when the variables name is specified.
- wc
- The command used to count the words, lines and characters in a file.
- word
- An unbroken set of characters. The shell uses spaces and tabs to separate words.
- write permission
- Controls the users who can modify a file.