Advanced Bash-Scripting Guide: An in-depth exploration of the art of shell scripting | ||
---|---|---|
Prev |
This index / glossary / quick-reference lists many of the important topics covered in the text. Terms are arranged in approximate sorting order, reshuffled as necessary for enhanced clarity.
Note that commands are indexed in Part 4.
* * *
^ Beginning-of-line, in a Regular Expression
~ Tilde
~ home directory, corresponds to $HOME
= Equals sign
= Variable assignment operator
= String comparison operator
== String comparison operator
=~ Regular Expression match operator
< Left angle bracket
< Is less than ASCII comparison
< Is less than, integer comparison within double parentheses
< Redirection, stdin
<< Redirection, in a here document
<<< Redirection, in a here string
<> Redirection, opening a file for both reading and writing
> Right angle bracket
> Is greater than ASCII comparison
> Is greater than, integer comparison within double parentheses
> Redirect, stdout to a file
>> Redirect, stdout to a file, but append
| Pipe, a device for passing the output of a command to another command or to the shell
- Dash
- Prefix to option flag
- Indicating redirection from stdin or stdout
-- (Double-dash) Prefix to long command options
-- C-style variable decrement within double parentheses
; Semicolon, as command separator
;; Double-semicolon, terminator in a case option
: Colon, equivalent to the true Bash builtin
! Negation operator, inverts exit status of a test or command
? Question mark, in a Regular Expression
// Double forward slash, behavior of cd command toward
. Dot / period
. Load a file (into a script), equivalent to source command
' ... ' Single quotes, "strong" quoting
" ... " Double quotes, "weak" quoting
( ... ) Parentheses, to group commands; starts a subshell
(( ... )) Double parentheses, in arithmetic expansion
[ Left bracket, test construct
[[ ... ]] Double brackets, extended test construct
$ Anchor, in a Regular Expression
$( ... ) Command substitution, setting a variable with output of a command, using parentheses notation
` ... ` Command substitution, using backquotes notation
${ ... }
${var} Value of a variable
${#var} Length of a variable
${#@}, ${#*} Number of postional parameters
${var#Pattern}, ${var##Pattern} Substring removal
\ Escape the following character
\< ... \> Angle brackets, escaped, word boundary in a Regular Expression
# Hashmark, special symbol beginning a script comment
#! Sha-bang, special string starting a shell script
* Asterisk
** Exponentiation, arithmetic operator
% Percent sign
Modulo, division-remainder arithmetic operation
+ Character match, in an extended Regular Expression
++ C-style variable increment, within double parentheses
* * *
Shell Variables
$_ Last argument to previous command
$- Flags passed to script, using set
$! Process ID of last background job
$@ All the positional parameters, as separate words
$* All the positional parameters, as a single word
$$ Process ID of the script
$# Number of arguments passed to a function, or to the script itself
* * * * * *
Advanced Bash Scripting Guide, where to download
And list, to supply default command-line argument
Angle brackets, escaped, \< . . . \> word boundary in a Regular Expression
Anonymous here document, using :
awk field-oriented text processing language
rand(), random function
* * *
Backquotes, used in command substitution
Basic commands, external
Bison utility
Extended, {a..z}
Bracket notation, used for positional parameters
break loop control command
Builtins in Bash
* * *
cat, piping the output of, to a read
Colon, : , equivalent to the true Bash builtin
Comma operator, linking commands or operations
Commenting out blocks of code
Compound comparison operators
continue loop control command
Curly brackets, in find command
* * *
Daemons, in UNIX-type OS
dd command, thread
Decimal number, Bash interprets numbers as
declare builtin
/dev/null pseudo-device file
/dev/urandom pseudo-device file, generating pseudorandom numbers with
/dev/zero, pseudo-device file
dialog, utility for generating dialog boxes in a script
$DIRSTACK directory stack
Disabled commands, in restricted shells
do keyword, begins execution of commands within a loop
done keyword, terminates a loop
DOS batch files, converting to shell scripts
dot files, "hidden" setup and configuration files
Double brackets [[ ... ]] test construct
Double quotes (" ... ") "weak" quoting
* * *
-e File exists test command
echo, in combination with grep
elif, Contraction of else and if
-eq , equality integer comparison test
Escaped characters, special meanings of
$EUID, Effective user ID
eval, Evaluate expression(s), with variable expansion
exec command, using in redirection
Exit and Exit status
exit command
Exit codes with special meanings
Exit status, or return status of a command
Exit status, specified by a Function return
Export, to make available variables to child processes
expr, Expression evaluator
* * *
Floating point numbers, Bash does not recognize
Forking a child process
Return range limits, workarounds
* * *
Globbing, filename expansion
-gt , greater-than integer comparison test
$GROUPS, Groups user belongs to
* * *
Hashing, creating lookup keys in a table
Closing limit string may not be indented
$HOME, user's home directory
$HOSTNAME, system host name
* * *
if [ condition ]; then ... test construct
$IFS, Internal field separator variable, by which Bash determines field boundaries within strings
in, keyword preceding [list] in a for loop
Initialization table, /etc/inittab
Interactive script, test for
Indirect referencing of variables
New notation, introduced in version 2 of Bash
* * *
killall script in /etc/rc.d/init.d
* * *
Limit string, in a here document
$LINENO, variable indicating the line number where it appears in a script
Link, file (using ln command)
List constructs (and lists, or lists, etc.)
Logical operators (&&, ||, etc.)
Logout file, the ~/.bash_logout file
Loopback devices, in /dev directory
-lt , less-than integer comparison test
* * *
$MACHTYPE, Machine type
Magic number, marker at the head of a file indicating the file type
Makefile, file containing the list of dependencies used by make command
* * *
Named pipe, a temporary FIFO buffer
-ne, not-equal-to integer comparison test
Negation operator, !, reverses the sense of a test
Noclobber, -C option to Bash to prevent overwriting of files
* * *
$OLDPWD Previous working directory
Options, passed to shell or script on command line or by set command
* * *
Parameters, default (in parameter substitution)
Parameter-unset message, of form ${parameter?err_msg}
Parent / child process problem, a child process cannot export variables to a parent process
Parentheses, used to group commands
$PATH, the path (location of system binaries)
Perl programming language
Pipe, | , a device for passing the output of a command to another command or to the shell
Pipefail, set -o pipefail option to indicate exit status within a pipe
Piping output of a command to a script
POSIX, Portable Operating System Interface / UNIX
$PPID, process ID of parent process
Prepending lines at beginning of a file (script example)
Prompt
Pseudo-code, as problem-solving method
$PWD, Current working directory
* * *
Question mark, ? , in a Regular Expression
Quoting a character string
* * *
Random numbers
$RANDOM, Bash function that returns a pseudorandom integer
Random sequence generation, using date command
read, problems with piping echo to
Recursion, and local variables
Redirection
$REPLY, Default value associated with read command
Restricted shell, shell (or script) with certain commands disabled
return, command that terminates a function
* * *
Scope of a variable, definition
Script options, set at command line
Secondary prompt, $PS2
sed, pattern-based programming language
select, construct for menu building
Semicolon required, when do keyword is on the first line of loop
Shell script, definition of
Shell wrapper, script embedding a command or utility
shift, reassigning positional parameters
$SHLVL, shell level, depth to which the shell (or script) is nested
Signal, a message sent to a process
Single quotes (' ... ') "strong" quoting
Socket, a communication node associated with an I/O port
Startup files, Bash
Strings
Manipulation, using awk
Substring extraction, using expr
Substring index (numerical position in string)
Substring matching, using expr
"Strong" quoting (' ... ')
Variables, $BASH_SUBSHELL and $SHLVL
suid (set user id) file flag
* * *
$TMOUT, Timeout interval
Trap, specifying an action upon receipt of a signal
typeset builtin
* * *
$UID, User ID number
until loop, until [ condition-is-true ]; do
* * *
Variables
Expansion / Substring replacement operators
In subshell not visible to parent shell
Length, ${#var}
* * *
wait command, use of to remedy script hang
"Weak" quoting (" ... ")
while loop, while [ condition ]; do
while read construct
Whitespace, spaces, tabs, and newline characters
* * *
xargs, Filter for assembling arguments
* * *
Zombie, a process that has terminated, but not yet been killed by its parent process