11875 lines
135 KiB
HTML
11875 lines
135 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Index</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="Advanced Bash-Scripting Guide"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="ASCII Table"
|
|
HREF="asciitable.html"></HEAD
|
|
><BODY
|
|
CLASS="INDEX"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>Advanced Bash-Scripting Guide: </TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="asciitable.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
> </TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="INDEX"
|
|
><H1
|
|
><A
|
|
NAME="XREFINDEX"
|
|
></A
|
|
>Index</H1
|
|
><P
|
|
>This index / glossary / quick-reference lists many of the
|
|
important topics covered in the text. Terms are arranged
|
|
in <EM
|
|
>approximate</EM
|
|
> ASCII sorting order,
|
|
<EM
|
|
>modified as necessary</EM
|
|
> for enhanced
|
|
clarity.</P
|
|
><P
|
|
>Note that <EM
|
|
>commands</EM
|
|
> are indexed
|
|
in <A
|
|
HREF="part4.html#PART4A"
|
|
>Part 4</A
|
|
>.</P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>^ </B
|
|
> (caret)
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="special-chars.html#BEGLINEREF"
|
|
>Beginning-of-line</A
|
|
>,
|
|
in a <A
|
|
HREF="regexp.html#REGEXREF"
|
|
>Regular Expression</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>^</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>^^</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#CASEMODPARAMSUB"
|
|
>Uppercase
|
|
conversion</A
|
|
> in <I
|
|
CLASS="FIRSTTERM"
|
|
>parameter
|
|
substitution</I
|
|
></P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>~ </B
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>Tilde</I
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>~ </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#TILDEREF"
|
|
>home directory</A
|
|
>, corresponds
|
|
to <A
|
|
HREF="internalvariables.html#HOMEDIRREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$HOME</TT
|
|
></A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>~/ </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#TILDEREF"
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>Current user's</I
|
|
>
|
|
home directory</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>~+ </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#WORKINGDIRREF"
|
|
><EM
|
|
>Current</EM
|
|
>
|
|
working directory</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>~- </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#PREVWORKINGDIR"
|
|
><EM
|
|
>Previous</EM
|
|
>
|
|
working directory</A
|
|
>
|
|
</P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>= </B
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>Equals</I
|
|
> sign
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>= </B
|
|
>
|
|
<A
|
|
HREF="varassignment.html#EQREF"
|
|
>Variable assignment</A
|
|
> operator
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>= </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#SCOMPARISON1"
|
|
>String comparison</A
|
|
> operator
|
|
</P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>== </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#SCOMPARISON2"
|
|
>String comparison</A
|
|
> operator
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>=~ </B
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Regular Expression</I
|
|
>
|
|
<A
|
|
HREF="bashver3.html#REGEXMATCHREF"
|
|
>match</A
|
|
> operator
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#FINDSPLIT0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Example
|
|
script</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>< </B
|
|
> Left angle bracket
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Is-less-than</P
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#LTREF"
|
|
>String comparison</A
|
|
></P
|
|
><P
|
|
> <A
|
|
HREF="comparison-ops.html#INTLT"
|
|
>Integer comparison</A
|
|
> within
|
|
<A
|
|
HREF="dblparens.html"
|
|
>double parentheses</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Redirection</P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>< </B
|
|
>
|
|
<A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF2"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
></A
|
|
>
|
|
</P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
><< </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#HEREDOCRRREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Here document</I
|
|
></A
|
|
>
|
|
</P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
><<< </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#HERESTRINGREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Here string</I
|
|
></A
|
|
>
|
|
</P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
><> </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#REDIRRW"
|
|
>Opening a file</A
|
|
> for
|
|
<EM
|
|
>both</EM
|
|
> reading and writing
|
|
</P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>> </B
|
|
> Right angle bracket
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Is-greater-than</P
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#GTREF"
|
|
>String comparison</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#INTGT"
|
|
>Integer comparison</A
|
|
>,
|
|
within <I
|
|
CLASS="FIRSTTERM"
|
|
>double parentheses</I
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Redirection</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>> </B
|
|
>
|
|
<A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF"
|
|
>Redirect
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></A
|
|
> to a file
|
|
</P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>>> </B
|
|
>
|
|
<A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF"
|
|
>Redirect
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></A
|
|
> to a file,
|
|
but <I
|
|
CLASS="FIRSTTERM"
|
|
>append</I
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>i>&j </B
|
|
>
|
|
<A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF1"
|
|
>Redirect
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>file descriptor</I
|
|
>
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>i</TT
|
|
></A
|
|
> to
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>file descriptor</I
|
|
>
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>j</TT
|
|
></P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>>&j </B
|
|
>
|
|
<A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF1"
|
|
>Redirect
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></A
|
|
> to
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>file descriptor</I
|
|
>
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>j</TT
|
|
></P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>>&2 </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#REDIROUTERROR2"
|
|
>Redirect
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></A
|
|
> of a command to
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stderr</TT
|
|
></P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>2>&1 </B
|
|
>
|
|
<A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF1"
|
|
>Redirect
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stderr</TT
|
|
></A
|
|
>
|
|
to <TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>&> </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#REDIROUTERROR"
|
|
>Redirect
|
|
<EM
|
|
>both</EM
|
|
> <TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
>
|
|
and <TT
|
|
CLASS="FILENAME"
|
|
>stderr</TT
|
|
></A
|
|
> of a command to a
|
|
file</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>:> <TT
|
|
CLASS="FILENAME"
|
|
>file</TT
|
|
></B
|
|
>
|
|
<A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF"
|
|
>Truncate file</A
|
|
>
|
|
to zero length</P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>| </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#PIPEREF"
|
|
>Pipe</A
|
|
>, a device for passing the output
|
|
of a command to another command or to the shell</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>|| </B
|
|
>
|
|
<A
|
|
HREF="ops.html#ORREF"
|
|
>Logical OR test operator</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>- </B
|
|
> (dash)
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="parameter-substitution.html#DEFPARAM1"
|
|
>Prefix to <I
|
|
CLASS="FIRSTTERM"
|
|
>default
|
|
parameter</I
|
|
></A
|
|
>, in <I
|
|
CLASS="FIRSTTERM"
|
|
>parameter
|
|
substitution</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="special-chars.html#DASHREF"
|
|
>Prefix to <I
|
|
CLASS="FIRSTTERM"
|
|
>option
|
|
flag</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="special-chars.html#DASHREF2"
|
|
>Indicating
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>redirection</I
|
|
></A
|
|
> from
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
> or <TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-- </B
|
|
> (double-dash)</P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#DOUBLEDASHREF"
|
|
>Prefix to
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>long</I
|
|
> command options</A
|
|
></P
|
|
><P
|
|
> <A
|
|
HREF="dblparens.html#PLUSPLUSREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>C-style</I
|
|
>
|
|
variable decrement</A
|
|
> within <A
|
|
HREF="dblparens.html#DBLPARENSREF"
|
|
>double
|
|
parentheses</A
|
|
>
|
|
</P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>; </B
|
|
> (semicolon)
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#SEMICOLONREF"
|
|
>As command
|
|
separator</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>\; </B
|
|
>
|
|
<A
|
|
HREF="moreadv.html#FINDREF0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Escaped</I
|
|
> semicolon</A
|
|
>,
|
|
terminates a <A
|
|
HREF="moreadv.html#FINDREF"
|
|
>find</A
|
|
>
|
|
command</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>;; </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#DOUBLESEMICOLON"
|
|
>Double-semicolon</A
|
|
>, terminator in a
|
|
<A
|
|
HREF="testbranch.html#CASEESAC1"
|
|
>case</A
|
|
> option</P
|
|
><P
|
|
>Required when ...</P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#NEEDSEMICOLON"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>do</I
|
|
>
|
|
keyword is on the first line of
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>loop</I
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#OMITSEMICOLON"
|
|
> terminating <I
|
|
CLASS="FIRSTTERM"
|
|
>curly-bracketed</I
|
|
>
|
|
code block</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>;;&</B
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>;&</B
|
|
>
|
|
<A
|
|
HREF="bashver4.html#NCTERM"
|
|
>Terminators</A
|
|
> in
|
|
a <I
|
|
CLASS="FIRSTTERM"
|
|
>case</I
|
|
> option (<A
|
|
HREF="bashver4.html#BASH4REF"
|
|
>version 4+</A
|
|
> of Bash).</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>:</B
|
|
> Colon
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>:> <TT
|
|
CLASS="FILENAME"
|
|
>filename</TT
|
|
></B
|
|
>
|
|
<A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF"
|
|
>Truncate file</A
|
|
>
|
|
to zero length</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#NULLREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>null</I
|
|
>
|
|
command</A
|
|
>, equivalent to the
|
|
<A
|
|
HREF="internal.html#TRUEREF"
|
|
>true</A
|
|
> Bash
|
|
builtin</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Used in an <A
|
|
HREF="here-docs.html#ANONHEREDOC0"
|
|
>anonymous
|
|
here document</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Used in an <A
|
|
HREF="special-chars.html#COLONINFUNCTION"
|
|
>otherwise
|
|
empty function</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Used as a <A
|
|
HREF="functions.html#FSTRANGEREF"
|
|
>function
|
|
name</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>! </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#NOTREF"
|
|
>Negation operator</A
|
|
>, inverts <A
|
|
HREF="exit-status.html#NEGCOND"
|
|
>exit status</A
|
|
> of a test or command
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>!= </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#NOTEQUAL"
|
|
>not-equal-to</A
|
|
>
|
|
String comparison operator</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>? </B
|
|
> (question mark)
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="x17129.html#QUEXREGEX"
|
|
>Match zero or one characters</A
|
|
>,
|
|
in an <A
|
|
HREF="x17129.html#EXTREGEX"
|
|
> Extended Regular
|
|
Expression</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#QUEXWC"
|
|
>Single-character
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>wild card</I
|
|
></A
|
|
>,
|
|
in <A
|
|
HREF="globbingref.html"
|
|
>globbing</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>In a
|
|
<A
|
|
HREF="special-chars.html#CSTRINARY"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>C</I
|
|
>-style
|
|
Trinary operator</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>// </B
|
|
>
|
|
<A
|
|
HREF="internal.html#DOUBLESLASHREF"
|
|
>Double forward slash</A
|
|
>,
|
|
behavior of <A
|
|
HREF="internal.html#CDREF"
|
|
>cd</A
|
|
> command toward</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>. </B
|
|
> (dot / period)
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>. </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#DOTREF"
|
|
>Load a file</A
|
|
> (into a script),
|
|
equivalent to <A
|
|
HREF="internal.html#SOURCEREF"
|
|
>source</A
|
|
> command
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>. </B
|
|
>
|
|
<A
|
|
HREF="x17129.html#REGEXDOT"
|
|
>Match single character</A
|
|
>,
|
|
in a <A
|
|
HREF="regexp.html#REGEXREF"
|
|
>Regular Expression</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>. </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#DOTDIRECTORY"
|
|
>Current working
|
|
directory</A
|
|
>
|
|
</P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>./ </B
|
|
>
|
|
<A
|
|
HREF="internalvariables.html#CURRENTWDREF"
|
|
>Current working
|
|
directory</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>.. </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#DOTDIRECTORY"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Parent</I
|
|
>
|
|
directory</A
|
|
>
|
|
</P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>' ... '</B
|
|
>
|
|
(single quotes)
|
|
<A
|
|
HREF="varsubn.html#SNGLQUO"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>strong</I
|
|
>
|
|
quoting</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>" ... " </B
|
|
>
|
|
(double quotes)
|
|
<A
|
|
HREF="varsubn.html#DBLQUO"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>weak</I
|
|
>
|
|
quoting</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="quotingvar.html#QUOTINGBSL"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Double-quoting</I
|
|
>
|
|
the <I
|
|
CLASS="FIRSTTERM"
|
|
>backslash</I
|
|
> (<B
|
|
CLASS="COMMAND"
|
|
>\</B
|
|
>)
|
|
character</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>,</B
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="ops.html#COMMAOP"
|
|
>Comma operator</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>,</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>,,</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#CASEMODPARAMSUB"
|
|
>Lowercase
|
|
conversion</A
|
|
> in <I
|
|
CLASS="FIRSTTERM"
|
|
>parameter
|
|
substitution</I
|
|
></P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>() </B
|
|
> Parentheses
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>( ... ) </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#PARENSREF"
|
|
>Command group</A
|
|
>;
|
|
starts a
|
|
<A
|
|
HREF="subshells.html#SUBSHELLSREF"
|
|
>subshell</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>( ... ) </B
|
|
>
|
|
<A
|
|
HREF="x17129.html#PARENGRPS"
|
|
>Enclose group</A
|
|
>
|
|
of <I
|
|
CLASS="FIRSTTERM"
|
|
>Extended Regular
|
|
Expressions</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>>( ... )</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
><( ... ) </B
|
|
>
|
|
<A
|
|
HREF="process-sub.html#PROCESSSUBREF"
|
|
>Process substitution</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
> ... ) </B
|
|
>
|
|
<A
|
|
HREF="testbranch.html#CASEPAREN"
|
|
>Terminates test-condition</A
|
|
>
|
|
in <I
|
|
CLASS="FIRSTTERM"
|
|
>case</I
|
|
> construct</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>(( ... )) </B
|
|
>
|
|
<A
|
|
HREF="dblparens.html#DBLPARENSREF"
|
|
>Double parentheses</A
|
|
>,
|
|
in arithmetic expansion</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>[ </B
|
|
> <A
|
|
HREF="special-chars.html#LEFTBRACKET"
|
|
>Left bracket</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>test</I
|
|
> construct</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>[ ]</B
|
|
>Brackets
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#BRACKARRAY"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Array</I
|
|
>
|
|
element</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17129.html#BRACKETSREF"
|
|
>Enclose character set
|
|
to match</A
|
|
> in a <I
|
|
CLASS="FIRSTTERM"
|
|
>Regular
|
|
Expression</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#BRACKTEST"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Test</I
|
|
> construct</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>[[ ... ]]</B
|
|
>
|
|
<A
|
|
HREF="testconstructs.html#DBLBRACKETS"
|
|
>Double brackets</A
|
|
>,
|
|
extended <I
|
|
CLASS="FIRSTTERM"
|
|
>test</I
|
|
> construct</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$ </B
|
|
>
|
|
<A
|
|
HREF="x17129.html#DOLLARSIGNREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Anchor</I
|
|
></A
|
|
>,
|
|
in a <A
|
|
HREF="regexp.html#REGEXREF"
|
|
>Regular Expression</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$ </B
|
|
>
|
|
<A
|
|
HREF="varsubn.html"
|
|
>Prefix to a variable name</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$( ... ) </B
|
|
>
|
|
<A
|
|
HREF="varassignment.html#COMMANDSUBREF0"
|
|
>Command substitution</A
|
|
>,
|
|
setting a variable with output of a command,
|
|
using parentheses notation</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>` ... ` </B
|
|
>
|
|
<A
|
|
HREF="commandsub.html#BACKQUOTESREF"
|
|
>Command substitution</A
|
|
>,
|
|
using <A
|
|
HREF="special-chars.html#BACKTICKSREF"
|
|
>backquotes</A
|
|
>
|
|
notation</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$[ ... ]</B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#BRACKETARITH"
|
|
>Integer expansion</A
|
|
>
|
|
(deprecated)</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${ ... }</B
|
|
> Variable manipulation / evaluation
|
|
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${var}</B
|
|
>
|
|
<A
|
|
HREF="parameter-substitution.html#PSSUB1"
|
|
>Value of a variable</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${#var}</B
|
|
>
|
|
<A
|
|
HREF="parameter-substitution.html#PSOREX1"
|
|
>Length of a variable</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${#@}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${#*}</B
|
|
>
|
|
<A
|
|
HREF="parameter-substitution.html#NUMPOSPARAM"
|
|
>Number of
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>positional
|
|
parameters</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${parameter?err_msg}</B
|
|
>
|
|
<A
|
|
HREF="parameter-substitution.html#QERRMSG"
|
|
>Parameter-unset
|
|
message</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${parameter-default}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${parameter:-default}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${parameter=default}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${parameter:=default}</B
|
|
>
|
|
<A
|
|
HREF="parameter-substitution.html#DEFPARAM1"
|
|
>Set default
|
|
parameter</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${parameter+alt_value}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${parameter:+alt_value}</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PARAMALTV"
|
|
>Alternate value</A
|
|
>
|
|
of parameter, if set</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${!var}</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="ivr.html#IVR2"
|
|
>Indirect referencing of a variable</A
|
|
>,
|
|
new notation</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${!#}</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#LASTARGREF"
|
|
>Final <I
|
|
CLASS="FIRSTTERM"
|
|
>positional
|
|
parameter</I
|
|
></A
|
|
>.
|
|
(This is an <I
|
|
CLASS="FIRSTTERM"
|
|
>indirect reference</I
|
|
> to
|
|
<A
|
|
HREF="internalvariables.html#CLACOUNTREF"
|
|
>$#</A
|
|
>.)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${!varprefix*}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${!varprefix@}</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#VARPREFIXM"
|
|
>Match
|
|
<EM
|
|
>names</EM
|
|
></A
|
|
> of all previously declared
|
|
variables beginning with <TT
|
|
CLASS="VARNAME"
|
|
>varprefix</TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${string:position}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${string:position:length}</B
|
|
>
|
|
<A
|
|
HREF="string-manipulation.html#SUBSTREXTR01"
|
|
>Substring
|
|
extraction</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${var#Pattern}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${var##Pattern}</B
|
|
>
|
|
<A
|
|
HREF="parameter-substitution.html#PSOREX2"
|
|
>Substring
|
|
removal</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${var%Pattern}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${var%%Pattern}</B
|
|
>
|
|
<A
|
|
HREF="parameter-substitution.html#PCTPATREF"
|
|
>Substring
|
|
removal</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${string/substring/replacement}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${string//substring/replacement}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${string/#substring/replacement}</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>${string/%substring/replacement}</B
|
|
>
|
|
<A
|
|
HREF="string-manipulation.html#SUBSTRREPL00"
|
|
>Substring
|
|
replacement</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$' ... '</B
|
|
>
|
|
<A
|
|
HREF="escapingsection.html#STRQ"
|
|
>String expansion</A
|
|
>,
|
|
using <I
|
|
CLASS="FIRSTTERM"
|
|
>escaped</I
|
|
> characters.</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>\ </B
|
|
>
|
|
<A
|
|
HREF="escapingsection.html#ESCP"
|
|
>Escape</A
|
|
> the character following
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>\< ... \> </B
|
|
>
|
|
<A
|
|
HREF="x17129.html#ANGLEBRAC"
|
|
>Angle brackets</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>escaped</I
|
|
>,
|
|
word boundary in a <A
|
|
HREF="regexp.html#REGEXREF"
|
|
>Regular
|
|
Expression</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>\{ N \}</B
|
|
>
|
|
<A
|
|
HREF="x17129.html#ESCPCB"
|
|
><SPAN
|
|
CLASS="QUOTE"
|
|
>"Curly"</SPAN
|
|
> brackets</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>escaped</I
|
|
>,
|
|
number of character sets to match in an <A
|
|
HREF="x17129.html#EXTREGEX"
|
|
>Extended RE</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>\; </B
|
|
>
|
|
<A
|
|
HREF="moreadv.html#FINDREF0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Semicolon</I
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>escaped</I
|
|
>,
|
|
terminates a <A
|
|
HREF="moreadv.html#FINDREF"
|
|
>find</A
|
|
>
|
|
command</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>\$$ </B
|
|
> <A
|
|
HREF="ivr.html#IVRREF"
|
|
>Indirect
|
|
reverencing of a variable</A
|
|
>, old-style notation</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="escapingsection.html#ESCNEWLINE"
|
|
>Escaping
|
|
a <I
|
|
CLASS="FIRSTTERM"
|
|
>newline</I
|
|
></A
|
|
>,
|
|
to write a multi-line command</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>& </B
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>&> </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#REDIROUTERROR"
|
|
>Redirect
|
|
<EM
|
|
>both</EM
|
|
> <TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
>
|
|
and <TT
|
|
CLASS="FILENAME"
|
|
>stderr</TT
|
|
></A
|
|
> of a command to a
|
|
file</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>>&j </B
|
|
>
|
|
<A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF1"
|
|
>Redirect
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></A
|
|
> to
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>file descriptor</I
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>j</I
|
|
></P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>>&2 </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#REDIROUTERROR2"
|
|
>Redirect
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></A
|
|
> of a command to
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stderr</TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>i>&j </B
|
|
>
|
|
<A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF1"
|
|
>Redirect
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>file descriptor</I
|
|
></A
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>i</I
|
|
> to
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>file descriptor</I
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>j</I
|
|
></P
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>2>&1 </B
|
|
>
|
|
<A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF1"
|
|
>Redirect
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stderr</TT
|
|
></A
|
|
> to
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="io-redirection.html#CFD"
|
|
>Closing <I
|
|
CLASS="FIRSTTERM"
|
|
>file
|
|
descriptors</I
|
|
></A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>n<&-</B
|
|
>
|
|
Close input file descriptor
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>n</I
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>0<&-</B
|
|
>,
|
|
<B
|
|
CLASS="COMMAND"
|
|
><&-</B
|
|
>
|
|
Close <TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>n>&-</B
|
|
>
|
|
Close output file descriptor
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>n</I
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>1>&-</B
|
|
>,
|
|
<B
|
|
CLASS="COMMAND"
|
|
>>&-</B
|
|
>
|
|
Close <TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>&& </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#LOGICALAND"
|
|
>Logical AND
|
|
test operator</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>Command &</B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#BGJOB"
|
|
>Run job in
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>background</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
># </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#HASHMARKREF"
|
|
>Hashmark</A
|
|
>,
|
|
special symbol beginning a script
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>comment</I
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>#!</B
|
|
>
|
|
<A
|
|
HREF="sha-bang.html#SHABANGREF"
|
|
>Sha-bang</A
|
|
>,
|
|
special string starting a
|
|
<A
|
|
HREF="part1.html#WHATSASCRIPT"
|
|
>shell script</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>* </B
|
|
> Asterisk
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="special-chars.html#ASTERISKREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Wild
|
|
card</I
|
|
></A
|
|
>,
|
|
in <A
|
|
HREF="globbingref.html"
|
|
>globbing</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="special-chars.html#ASTERISKREF2"
|
|
>Any number of characters</A
|
|
>
|
|
in a <A
|
|
HREF="regexp.html#REGEXREF"
|
|
>Regular Expression</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
> ** </B
|
|
>
|
|
<A
|
|
HREF="ops.html#EXPONENTIATIONREF"
|
|
>Exponentiation</A
|
|
>,
|
|
arithmetic operator
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
> ** </B
|
|
>
|
|
Extended <I
|
|
CLASS="FIRSTTERM"
|
|
>globbing</I
|
|
>
|
|
<A
|
|
HREF="bashver4.html#GLOBSTARREF"
|
|
>file-match operator</A
|
|
>
|
|
</P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>% </B
|
|
> Percent sign
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="ops.html#MODULOREF"
|
|
>Modulo</A
|
|
>, division-remainder
|
|
arithmetic operation
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="parameter-substitution.html#PCTPATREF"
|
|
>Substring removal</A
|
|
>
|
|
(pattern matching) operator</P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>+ </B
|
|
> Plus sign
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17129.html#PLUSREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Character
|
|
match</I
|
|
></A
|
|
>, in an <A
|
|
HREF="x17129.html#EXTREGEX"
|
|
>extended Regular
|
|
Expression</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PARAMALTV"
|
|
>Prefix to
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>alternate parameter</I
|
|
></A
|
|
>, in
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>parameter substitution</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
> ++ </B
|
|
>
|
|
<A
|
|
HREF="dblparens.html#PLUSPLUSREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>C-style</I
|
|
>
|
|
variable increment</A
|
|
>, within
|
|
<A
|
|
HREF="dblparens.html#DBLPARENSREF"
|
|
>double
|
|
parentheses</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Shell Variables</I
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$_ </B
|
|
>
|
|
<A
|
|
HREF="internalvariables.html#UNDERSCOREREF"
|
|
>Last argument to previous
|
|
command</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$- </B
|
|
>
|
|
<A
|
|
HREF="internalvariables.html#FLPREF"
|
|
>Flags passed to script</A
|
|
>, using <A
|
|
HREF="internal.html#SETREF"
|
|
>set</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$! </B
|
|
>
|
|
<A
|
|
HREF="internalvariables.html#PIDVARREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Process ID</I
|
|
>
|
|
of last background job</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$? </B
|
|
>
|
|
<A
|
|
HREF="exit-status.html#EXSREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Exit
|
|
status</I
|
|
> of a command</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$@ </B
|
|
>
|
|
All the <I
|
|
CLASS="FIRSTTERM"
|
|
>positional parameters</I
|
|
>, <A
|
|
HREF="internalvariables.html#APPREF2"
|
|
>as <EM
|
|
>separate</EM
|
|
>
|
|
words</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
> $* </B
|
|
>
|
|
All the <I
|
|
CLASS="FIRSTTERM"
|
|
>positional parameters</I
|
|
>, <A
|
|
HREF="internalvariables.html#APPREF"
|
|
>as a <EM
|
|
>single</EM
|
|
>
|
|
word</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$$ </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#PROCESSIDREF"
|
|
>Process ID</A
|
|
> of the
|
|
script</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$# </B
|
|
>
|
|
<A
|
|
HREF="internalvariables.html#CLACOUNTREF"
|
|
>Number of arguments passed</A
|
|
> to a
|
|
<A
|
|
HREF="functions.html#FUNCTIONREF"
|
|
>function</A
|
|
>, or to the script
|
|
itself</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$0 </B
|
|
>
|
|
<A
|
|
HREF="othertypesv.html#SCRNAMEPARAM"
|
|
>Filename of the script</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$1 </B
|
|
>
|
|
<A
|
|
HREF="othertypesv.html#POSPARAMREF1"
|
|
>First argument passed to script</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$9 </B
|
|
>
|
|
<A
|
|
HREF="othertypesv.html#POSPARAMREF1"
|
|
>Ninth argument passed to script</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="refcards.html#SPECSHVARTAB"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>Table</B
|
|
></A
|
|
>
|
|
of <I
|
|
CLASS="FIRSTTERM"
|
|
>shell variables</I
|
|
></P
|
|
><P
|
|
>* * * * * *</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-a </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#COMPOUNDAND"
|
|
>Logical AND</A
|
|
>
|
|
compound comparison test</P
|
|
><P
|
|
>Address database, <A
|
|
HREF="testbranch.html#EX30"
|
|
>script
|
|
example</A
|
|
></P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Advanced Bash Scripting Guide</I
|
|
>,
|
|
<A
|
|
HREF="mirrorsites.html#WHERE_TARBALL"
|
|
>where to download</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="aliases.html#ALIASREF"
|
|
>Alias</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="aliases.html#UNALIASREF"
|
|
>Removing an
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>alias</I
|
|
></A
|
|
>, using
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>unalias</I
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="commandsub.html#AGRAM2"
|
|
>Anagramming</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="list-cons.html#LCONS1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>And</I
|
|
> list</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="list-cons.html#ANDDEFAULT"
|
|
>To supply default command-line
|
|
argument</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="ops.html#LOGOPS1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>And</I
|
|
> logical
|
|
operator</A
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>&&</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="x17129.html#ANGLEBRAC"
|
|
>Angle brackets</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>escaped</I
|
|
>,
|
|
<B
|
|
CLASS="COMMAND"
|
|
>\< . . . \> </B
|
|
>
|
|
word boundary in a <A
|
|
HREF="regexp.html#REGEXREF"
|
|
>Regular
|
|
Expression</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#ANONHEREDOC0"
|
|
>Anonymous
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>here document</I
|
|
></A
|
|
>, using
|
|
<B
|
|
CLASS="COMMAND"
|
|
>:</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#FAARCHIVING1"
|
|
>Archiving</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#RPMREF"
|
|
>rpm</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#TARREF"
|
|
>tar</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="arithexp.html#ARITHEXPREF"
|
|
>Arithmetic expansion</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="testconstructs.html#ARXS"
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>exit status</I
|
|
> of</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arithexp.html#ARITHEXPVAR1"
|
|
> variations of</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="ops.html#AROPS1"
|
|
>Arithmetic operators</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="ops.html#ARITHOPSCOMB"
|
|
> combination operators</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>C</I
|
|
>-style</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
> += </B
|
|
>
|
|
<B
|
|
CLASS="COMMAND"
|
|
> -= </B
|
|
>
|
|
<B
|
|
CLASS="COMMAND"
|
|
> *= </B
|
|
>
|
|
<B
|
|
CLASS="COMMAND"
|
|
> /= </B
|
|
>
|
|
<B
|
|
CLASS="COMMAND"
|
|
> %= </B
|
|
>
|
|
</P
|
|
><DIV
|
|
CLASS="NOTE"
|
|
><P
|
|
></P
|
|
><TABLE
|
|
CLASS="NOTE"
|
|
WIDTH="90%"
|
|
BORDER="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="25"
|
|
ALIGN="CENTER"
|
|
VALIGN="TOP"
|
|
><IMG
|
|
SRC="../images/note.gif"
|
|
HSPACE="5"
|
|
ALT="Note"></TD
|
|
><TD
|
|
ALIGN="LEFT"
|
|
VALIGN="TOP"
|
|
><P
|
|
><A
|
|
HREF="bashver3.html#PLUSEQSTR"
|
|
>In certain contexts</A
|
|
>,
|
|
<B
|
|
CLASS="COMMAND"
|
|
>+=</B
|
|
> can also function as a <I
|
|
CLASS="FIRSTTERM"
|
|
>string
|
|
concatenation</I
|
|
> operator.</P
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYREF"
|
|
>Arrays</A
|
|
></P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#ASSOCARR"
|
|
>Associative arrays</A
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="optimizations.html#ASSOCARRTST"
|
|
>more efficient</A
|
|
>
|
|
than conventional arrays</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYREF"
|
|
>Bracket notation</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYAPPEND0"
|
|
>Concatenating</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>example script</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#COPYARRAY0"
|
|
>Copying</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="declareref.html#ARRAYDECLARE"
|
|
>Declaring</A
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>declare -a
|
|
array_name</TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYINDIR"
|
|
>Embedded
|
|
arrays</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#EMPTYARRAY0"
|
|
>Empty
|
|
arrays, empty elements</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>example
|
|
script</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYINDIR"
|
|
>Indirect references</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYINIT0"
|
|
>Initialization</A
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>array=( element1 element2 ... elementN)</TT
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYASSIGN0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Example
|
|
script</I
|
|
></A
|
|
></P
|
|
><P
|
|
>Using <A
|
|
HREF="arrays.html#ARRAYINITCS"
|
|
>command
|
|
substitution</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYINITCS"
|
|
>Loading a
|
|
file</A
|
|
> into an array</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYMULTIDIM"
|
|
>Multidimensional</A
|
|
>,
|
|
simulating</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYNEST"
|
|
>Nesting and
|
|
embedding</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYNOTATION"
|
|
>Notation
|
|
and usage</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYNUMELEMENTS"
|
|
>Number of elements in</A
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>${#array_name[@]}</TT
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>${#array_name[*]}</TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYSYNTAX"
|
|
>Operations</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#PASSARRAY"
|
|
>Passing
|
|
an <I
|
|
CLASS="FIRSTTERM"
|
|
>array</I
|
|
></A
|
|
> to a
|
|
function</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>As <A
|
|
HREF="assortedtips.html#RETARRAY"
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>return value</I
|
|
> from
|
|
a function</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Special properties,
|
|
<A
|
|
HREF="arrays.html#ARRAYSPECIALPROPS"
|
|
>example
|
|
script</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>String operations,
|
|
<A
|
|
HREF="arrays.html#ARRAYSTRINGOPS"
|
|
>example
|
|
script</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYUNSET"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>unset</I
|
|
> deletes array
|
|
elements</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
><P
|
|
><A
|
|
HREF="internal.html#READARROW"
|
|
>Arrow keys</A
|
|
>, detecting</P
|
|
><P
|
|
>ASCII
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#ASCIIDEF"
|
|
>Definition</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="asciitable.html"
|
|
> Scripts for generating ASCII table</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="awk.html"
|
|
>awk</A
|
|
> field-oriented text
|
|
processing language
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="randomvar.html#AWKRANDOMREF"
|
|
> <TT
|
|
CLASS="VARNAME"
|
|
>rand()</TT
|
|
></A
|
|
>,
|
|
random function</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#AWKSTRINGMANIP2"
|
|
>String
|
|
manipulation</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#EXPORTAWK"
|
|
>Using
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>export</I
|
|
></A
|
|
> to pass a variable to an
|
|
embedded <I
|
|
CLASS="FIRSTTERM"
|
|
>awk</I
|
|
> script</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
>Backlight, <A
|
|
HREF="system.html#BACKLIGHT"
|
|
>setting the
|
|
brightness</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#BACKTICKSREF"
|
|
>Backquotes</A
|
|
>,
|
|
used in <A
|
|
HREF="commandsub.html#BACKQUOTESREF"
|
|
>command
|
|
substitution</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="mathc.html#BASE0"
|
|
>Base conversion</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>example script</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="why-shell.html#BASHDEF"
|
|
>Bash</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#BASH3GOTCHA"
|
|
>Bad scripting
|
|
practices</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#BASICSREV0"
|
|
>Basics reviewed</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>script example</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="bash-options.html#CLOPTS"
|
|
>Command-line
|
|
options</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="options.html#OPTIONSTABLE"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>Table</B
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="portabilityissues.html#BASHCOMPAT"
|
|
>Features that classic
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Bourne</I
|
|
> shell lacks</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html"
|
|
>Internal variables</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="bashver2.html#BASH2REF"
|
|
> Version 2</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="bashver3.html#BASH3REF"
|
|
> Version 3</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#BASH4REF"
|
|
>Version 4</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#BASH41"
|
|
>Version 4.1</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#BASH42"
|
|
>Version 4.2</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="sample-bashrc.html"
|
|
>.bashrc</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#BASHSUBSHELLREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$BASH_SUBSHELL</TT
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="basic.html#BASICCOMMANDS1"
|
|
>Basic commands</A
|
|
>, external</P
|
|
><P
|
|
><A
|
|
HREF="dosbatch.html#DOSBATCH1"
|
|
>Batch files</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>DOS</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="timedate.html#BATCHPROCREF"
|
|
>Batch processing</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="mathc.html#BCREF"
|
|
>bc</A
|
|
>, calculator utility
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="mathc.html#BCHEREDOC"
|
|
>In a <I
|
|
CLASS="FIRSTTERM"
|
|
>here
|
|
document</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="mathc.html#BCTEMPLATE"
|
|
>Template</A
|
|
>
|
|
for calculating a script variable</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="biblio.html"
|
|
>Bibliography</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="textproc.html#BISONREF"
|
|
>Bison</A
|
|
> utility</P
|
|
><P
|
|
><A
|
|
HREF="ops.html#BITWSOPS1"
|
|
>Bitwise operators</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#BASE64"
|
|
>Example script</A
|
|
>
|
|
</P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="devref1.html#BLOCKDEVREF"
|
|
>Block devices</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="fto.html#BLOCKDEVTEST"
|
|
>testing
|
|
for</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#CODEBLOCKREF"
|
|
>Blocks of code</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#NODODONE"
|
|
>Iterating / looping</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#BLOCKIO"
|
|
>Redirection</A
|
|
></P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Script example</I
|
|
>:
|
|
<A
|
|
HREF="special-chars.html#BLOCKIO2"
|
|
>Redirecting output of a a code
|
|
block</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#BFS"
|
|
>Bootable flash drives</A
|
|
>, creating</P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#BRACEEXPREF"
|
|
>Brace expansion</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#BRACEEXPREF33"
|
|
>Extended</A
|
|
>,
|
|
<TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>{a..z}</I
|
|
></TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="bashver3.html#BRACEEXPREF3"
|
|
>Parameterizing</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>With <A
|
|
HREF="bashver4.html#BRACEEXPREF4"
|
|
>increment and
|
|
zero-padding</A
|
|
> (new feature in Bash, <A
|
|
HREF="bashver4.html#BASH4REF"
|
|
>version
|
|
4</A
|
|
>)</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>Brackets, <B
|
|
CLASS="COMMAND"
|
|
>[ ]</B
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#BRACKARRAY"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Array</I
|
|
>
|
|
element</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17129.html#BRACKETSREF"
|
|
>Enclose character set
|
|
to match</A
|
|
> in a <I
|
|
CLASS="FIRSTTERM"
|
|
>Regular
|
|
Expression</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#BRACKTEST"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Test</I
|
|
> construct</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>Brackets, <I
|
|
CLASS="FIRSTTERM"
|
|
>curly</I
|
|
>, <B
|
|
CLASS="COMMAND"
|
|
>{}</B
|
|
>,
|
|
used in</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#CODEBLOCKREF"
|
|
>Code
|
|
block</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#CURLYBRACKETSREF"
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>find</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17129.html#ESCPCB"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Extended Regular
|
|
Expressions</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#BRACKETNOTATION"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Positional
|
|
parameters</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#XARGSCURLYREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>xargs</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
><P
|
|
><A
|
|
HREF="loopcontrol.html#BRKCONT1"
|
|
>break</A
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>loop</I
|
|
> control command
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loopcontrol.html#BREAKPARAM"
|
|
>Parameter</A
|
|
>
|
|
(optional)</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internal.html#BUILTINREF"
|
|
>Builtins</A
|
|
> in
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Bash</I
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#BLTINFRK"
|
|
>Do not fork a subprocess</A
|
|
>
|
|
</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="testbranch.html#CASEESAC1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>case</I
|
|
>
|
|
construct</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="testbranch.html#CASECL"
|
|
>Command-line parameters</A
|
|
>,
|
|
handling</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="testbranch.html#CSGLOB"
|
|
>Globbing</A
|
|
>,
|
|
filtering strings with</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="basic.html#CATREF"
|
|
>cat</A
|
|
>,
|
|
con<I
|
|
CLASS="FIRSTTERM"
|
|
>cat</I
|
|
>entate file(s)
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="optimizations.html#CATABUSE"
|
|
>Abuse of</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#CATSCRIPTREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>cat</I
|
|
>
|
|
scripts</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="basic.html#CATLESSEFF"
|
|
>Less efficient than
|
|
redirecting <TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#READPIPEREF"
|
|
>Piping the output
|
|
of</A
|
|
>, to a <A
|
|
HREF="internal.html#READREF"
|
|
>read</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="basic.html#CATUSES"
|
|
>Uses of</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="devref1.html#CHARDEVREF"
|
|
>Character devices</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="fto.html#CHARDEVTEST"
|
|
>testing
|
|
for</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#CHECKSUMREF"
|
|
>Checksum</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#CHILDREF"
|
|
>Child processes</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#NULLREF"
|
|
>Colon</A
|
|
>, <B
|
|
CLASS="COMMAND"
|
|
>: </B
|
|
>,
|
|
equivalent to the <A
|
|
HREF="internal.html#TRUEREF"
|
|
>true</A
|
|
> Bash
|
|
builtin</P
|
|
><P
|
|
><A
|
|
HREF="colorizing.html#COLORIZINGREF"
|
|
>Colorizing scripts</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Cycling through the background colors, <A
|
|
HREF="contributed-scripts.html#SHOWALLC"
|
|
>example script</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="colorizing.html#COLORIZTABLE"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>Table</B
|
|
></A
|
|
> of
|
|
color escape sequences</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="colorizing.html#COLORIZTEMPL"
|
|
>Template</A
|
|
>,
|
|
colored text on colored background</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="ops.html#COMMAOP"
|
|
>Comma operator</A
|
|
>,
|
|
linking commands or operations</P
|
|
><P
|
|
><A
|
|
HREF="bash-options.html"
|
|
>Command-line options</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#CNFH"
|
|
>command_not_found_handle ()</A
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>builtin</I
|
|
> error-handling function
|
|
(<A
|
|
HREF="bashver4.html#BASH4REF"
|
|
>version 4+</A
|
|
> of Bash)</P
|
|
><P
|
|
><A
|
|
HREF="commandsub.html#COMMANDSUBREF"
|
|
>Command substitution</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="commandsub.html#CSPARENS"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$( ... )</B
|
|
></A
|
|
>,
|
|
preferred notation</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="commandsub.html#BACKQUOTESREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Backquotes</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="commandsub.html#CSTOOLSET"
|
|
>Extending the
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Bash</I
|
|
> toolset</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="commandsub.html#CSSUBSH"
|
|
>Invokes a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>subshell</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="commandsub.html#CSNEST"
|
|
>Nesting</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="commandsub.html#CSTRNL"
|
|
>Removes trailing newlines</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="commandsub.html#CSVL"
|
|
>Setting variable from loop output</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="commandsub.html#CSWS"
|
|
>Word
|
|
splitting</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#COMMENTH"
|
|
>Comment headers</A
|
|
>,
|
|
special purpose</P
|
|
><P
|
|
>Commenting out blocks of code
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Using an <A
|
|
HREF="here-docs.html#CBLOCK1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>anonymous</I
|
|
> here
|
|
document</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Using an <A
|
|
HREF="assortedtips.html#COMOUTBL"
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>if-then</I
|
|
> construct</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="communications.html"
|
|
>Communications and
|
|
hosts</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#CCOMPARISON1"
|
|
>Compound comparison</A
|
|
>
|
|
operators</P
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#FACOMPRESSION1"
|
|
>Compression utilities</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#BZIPREF"
|
|
>bzip2</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#COMPRESSREF"
|
|
>compress</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#GZIPREF"
|
|
>gzip</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#ZIPREF"
|
|
>zip</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loopcontrol.html#BRKCONT1"
|
|
>continue</A
|
|
> loop control command</P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#CONTROLCHARREF"
|
|
>Control characters</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#CTLCREF"
|
|
>Control-C</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>break</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#CTLDREF"
|
|
>Control-D</A
|
|
>,
|
|
terminate / log out / erase</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#CTLGREF"
|
|
>Control-G</A
|
|
>,
|
|
<TT
|
|
CLASS="USERINPUT"
|
|
><B
|
|
>BEL</B
|
|
></TT
|
|
>
|
|
(<I
|
|
CLASS="FIRSTTERM"
|
|
>beep</I
|
|
>)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#CTLHREF"
|
|
>Control-H</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>rubout</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#CTLJREF"
|
|
>Control-J</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>newline</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#CTLMREF"
|
|
>Control-M</A
|
|
>,
|
|
carriage return</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#COPROCREF"
|
|
>Coprocesses</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="system.html#CRONREF"
|
|
>cron</A
|
|
>, scheduling
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>daemon</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#CSTYLE"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>C</I
|
|
>-style syntax
|
|
</A
|
|
>, for handling variables</P
|
|
><P
|
|
><A
|
|
HREF="textproc.html#CWSOLVER"
|
|
>Crossword puzzle solver</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#GRONSFELD"
|
|
>Cryptography</A
|
|
></P
|
|
><P
|
|
>Curly brackets {}
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#CURLYBRACKETSREF"
|
|
>in
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>find</I
|
|
> command</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17129.html#ESCPCB"
|
|
>in an
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Extended Regular
|
|
Expression</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#XARGSCURLYREF"
|
|
>in
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>xargs</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="communications.html#DAEMONREF"
|
|
>Daemons</A
|
|
>, in UNIX-type OS</P
|
|
><P
|
|
><A
|
|
HREF="timedate.html#DATEREF"
|
|
>date</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="mathc.html#DCREF"
|
|
>dc</A
|
|
>, calculator utility</P
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#DDREF"
|
|
>dd</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>data
|
|
duplicator</I
|
|
> command
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#DDCONVERSIONS"
|
|
>Conversions</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#DDCOPY"
|
|
>Copying raw data</A
|
|
>
|
|
to/from devices</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#DDFDEL"
|
|
>File deletion</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>secure</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#DDKEYSTROKES"
|
|
>Keystrokes</A
|
|
>, capturing</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#DDOPTIONS"
|
|
>Options</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#DDRANDOM"
|
|
>Random access</A
|
|
> on a data
|
|
stream</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><EM
|
|
>Raspberry Pi</EM
|
|
>,
|
|
<A
|
|
HREF="extmisc.html#RPSDCARD01"
|
|
>script for preparing a bootable SD
|
|
card</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#DDSWAP"
|
|
>Swapfiles</A
|
|
>, initializing</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="biblio.html#DDLINK"
|
|
>Thread on
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>www.linuxquestions.org</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="debugging.html"
|
|
>Debugging scripts</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="debugging.html#DEBUGTOOLS"
|
|
>Tools</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="debugging.html#DEBUGTRAP"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Trapping</I
|
|
> at
|
|
exit</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="debugging.html#TRAPREF1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Trapping</I
|
|
>
|
|
signals</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="numerical-constants.html#NUMCONSTANTS"
|
|
>Decimal number</A
|
|
>,
|
|
Bash interprets numbers as</P
|
|
><P
|
|
><A
|
|
HREF="declareref.html#DECLARE1REF"
|
|
>declare</A
|
|
> builtin</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="declareref.html#DECLAREOPSREF1"
|
|
>options</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#DECLARECASEMOD"
|
|
>case-modification</A
|
|
>
|
|
options (<A
|
|
HREF="bashver4.html#BASH4REF"
|
|
>version 4+</A
|
|
> of Bash)
|
|
</P
|
|
></LI
|
|
></UL
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#DEFPARAM"
|
|
>Default parameters</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="devproc.html#DEVPROCREF"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>/dev</TT
|
|
></A
|
|
> directory
|
|
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="zeros.html#DEVNULLREF"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>/dev/null</TT
|
|
></A
|
|
>
|
|
pseudo-device file</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="randomvar.html#URANDOMREF"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>/dev/urandom</TT
|
|
></A
|
|
>
|
|
pseudo-device file, generating pseudorandom numbers
|
|
with</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="zeros.html#ZEROSREF1"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>/dev/zero</TT
|
|
></A
|
|
>,
|
|
pseudo-device file</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="devref1.html#DEVFILEREF"
|
|
>Device file</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#DIALOGREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>dialog</I
|
|
></A
|
|
>,
|
|
utility for generating <I
|
|
CLASS="FIRSTTERM"
|
|
>dialog</I
|
|
> boxes in
|
|
a script</P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#DIRSTACKREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$DIRSTACK</TT
|
|
></A
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>directory stack</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="restricted-sh.html#DISABLEDCOMMREF"
|
|
>Disabled commands</A
|
|
>,
|
|
in <I
|
|
CLASS="FIRSTTERM"
|
|
>restricted shells</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#DOINREF"
|
|
>do</A
|
|
> keyword,
|
|
begins execution of commands within a <A
|
|
HREF="loops.html#LOOPREF00"
|
|
>loop</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#DOINREF"
|
|
>done</A
|
|
> keyword,
|
|
terminates a loop</P
|
|
><P
|
|
><A
|
|
HREF="dosbatch.html#DOSBATCH1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>DOS</I
|
|
> batch
|
|
files</A
|
|
>, converting to shell scripts</P
|
|
><P
|
|
><A
|
|
HREF="dosbatch.html#DOSUNIXEQUIV"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>DOS</I
|
|
>
|
|
commands</A
|
|
>, UNIX equivalents of
|
|
(<B
|
|
CLASS="COMMAND"
|
|
>table</B
|
|
>)</P
|
|
><P
|
|
><A
|
|
HREF="basic.html#DOTFILESREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>dot files</I
|
|
></A
|
|
>,
|
|
<SPAN
|
|
CLASS="QUOTE"
|
|
>"hidden"</SPAN
|
|
> setup and configuration files</P
|
|
><P
|
|
><A
|
|
HREF="testconstructs.html#DBLBRACKETS"
|
|
>Double brackets</A
|
|
>
|
|
<B
|
|
CLASS="COMMAND"
|
|
>[[ ... ]]</B
|
|
> <A
|
|
HREF="tests.html#IFTHEN"
|
|
>test</A
|
|
>
|
|
construct</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>and <A
|
|
HREF="testconstructs.html#DBLBRAEV"
|
|
>evaluation of
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>octal/hex</I
|
|
> constants</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
><P
|
|
><A
|
|
HREF="dblparens.html#DBLPARENSREF"
|
|
>Double parentheses</A
|
|
>
|
|
<B
|
|
CLASS="COMMAND"
|
|
>(( ... )) </B
|
|
> arithmetic expansion/evaluation
|
|
construct</P
|
|
><P
|
|
><A
|
|
HREF="varsubn.html#DBLQUO"
|
|
>Double quotes</A
|
|
>
|
|
<B
|
|
CLASS="COMMAND"
|
|
>" ... "</B
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>weak</I
|
|
> quoting
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="quotingvar.html#QUOTINGBSL"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Double-quoting</I
|
|
>
|
|
the <I
|
|
CLASS="FIRSTTERM"
|
|
>backslash</I
|
|
> (<B
|
|
CLASS="COMMAND"
|
|
>\</B
|
|
>)
|
|
character</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="x23170.html#DOUBLESPACE"
|
|
>Double-spacing a text
|
|
file</A
|
|
>, using <A
|
|
HREF="sedawk.html#SEDREF"
|
|
>sed</A
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-e </B
|
|
>
|
|
<A
|
|
HREF="fto.html#RTIF"
|
|
>File exists</A
|
|
> test</P
|
|
><P
|
|
><A
|
|
HREF="internal.html#ECHOREF"
|
|
>echo</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#ECHOGREPREF"
|
|
>Feeding commands down
|
|
a <I
|
|
CLASS="FIRSTTERM"
|
|
>pipe</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#ECHOCS"
|
|
>Setting a variable</A
|
|
>
|
|
using <A
|
|
HREF="commandsub.html#COMMANDSUBREF"
|
|
>command
|
|
substitution</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#BINECHO"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>/bin/echo</TT
|
|
></A
|
|
>,
|
|
external <I
|
|
CLASS="FIRSTTERM"
|
|
>echo</I
|
|
> command</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="testconstructs.html#ELIFREF1"
|
|
>elif</A
|
|
>,
|
|
Contraction of <I
|
|
CLASS="FIRSTTERM"
|
|
>else</I
|
|
>
|
|
and <A
|
|
HREF="tests.html#IFTHEN"
|
|
>if</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="testconstructs.html#ELSEREF"
|
|
>else</A
|
|
></P
|
|
><P
|
|
>Encrypting files, using <A
|
|
HREF="filearchiv.html#OPENSSLREF"
|
|
>openssl</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="testbranch.html#CASEESAC1"
|
|
>esac</A
|
|
>, keyword terminating
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>case</I
|
|
> construct</P
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#ENVREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Environmental</I
|
|
>
|
|
variables</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#EQUALREF"
|
|
> -eq </A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>is-equal-to</I
|
|
> <A
|
|
HREF="comparison-ops.html#ICOMPARISON1"
|
|
>integer
|
|
comparison</A
|
|
> test</P
|
|
><P
|
|
><A
|
|
HREF="arrays.html#PRIMES0"
|
|
>Eratosthenes,
|
|
Sieve of</A
|
|
>, algorithm for generating prime numbers</P
|
|
><P
|
|
><A
|
|
HREF="escapingsection.html#SPM"
|
|
>Escaped characters</A
|
|
>,
|
|
special meanings of
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Within <A
|
|
HREF="escapingsection.html#STRQ"
|
|
>$' ... '</A
|
|
>
|
|
string expansion</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#UNICODEREF2"
|
|
>Used with
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Unicode</I
|
|
> characters</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="system.html#FSTABREF"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>/etc/fstab</TT
|
|
></A
|
|
>
|
|
(filesystem mount) file</P
|
|
><P
|
|
><A
|
|
HREF="files.html#DATAFILESREF1"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>/etc/passwd</TT
|
|
></A
|
|
>
|
|
(user account) file</P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#EUIDREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$EUID</TT
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Effective user ID</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internal.html#EVALREF"
|
|
>eval</A
|
|
>,
|
|
Combine and <I
|
|
CLASS="FIRSTTERM"
|
|
>evaluate</I
|
|
> expression(s),
|
|
with variable expansion
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#EVALEFF"
|
|
>Effects
|
|
of</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>Example script</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#EVALFORCED"
|
|
>Forces
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>reevaluation</I
|
|
></A
|
|
> of
|
|
arguments</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>And <A
|
|
HREF="ivr.html#EVALINDREF"
|
|
>indirect
|
|
references</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#EVALRISK"
|
|
>Risk of
|
|
using</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#SAMORSE"
|
|
>Using
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>eval</I
|
|
> to convert <I
|
|
CLASS="FIRSTTERM"
|
|
>array</I
|
|
>
|
|
elements into a command list</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#ARRCHOICE0"
|
|
>Using
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>eval</I
|
|
> to select among
|
|
variables</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="testconstructs.html#DBLBRAEV"
|
|
>Evaluation of
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>octal/hex</I
|
|
> constants within
|
|
[[ ... ]]</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="x17974.html#USINGEXECREF"
|
|
>exec</A
|
|
> command,
|
|
using in <A
|
|
HREF="io-redirection.html#IOREDIRREF"
|
|
>redirection</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="exercises.html"
|
|
>Exercises</A
|
|
></P
|
|
><P
|
|
>Exit and Exit status
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="exit-status.html#EXITCOMMANDREF"
|
|
>exit</A
|
|
>
|
|
command</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="exit-status.html#EXITSTATUSREF"
|
|
>Exit status</A
|
|
>
|
|
(<I
|
|
CLASS="FIRSTTERM"
|
|
>exit code</I
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>return</I
|
|
>
|
|
status of a command)</P
|
|
><P
|
|
><A
|
|
HREF="exitcodes.html#EXITCODESREF"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>Table</B
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Exit
|
|
codes</I
|
|
> with special meanings</P
|
|
><P
|
|
> <A
|
|
HREF="gotchas.html#GOTCHAEXITVALANAMALIES"
|
|
>Anomalous</A
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="exitcodes.html#EXCOOR"
|
|
>Out of range</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="exit-status.html#PIPEEX"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Pipe</I
|
|
></A
|
|
>
|
|
exit status</P
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#EXITRETURN1"
|
|
> Specified by a <I
|
|
CLASS="FIRSTTERM"
|
|
>function
|
|
return</I
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="exit-status.html#EXITSUCCESS"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Successful</I
|
|
></A
|
|
>,
|
|
<B
|
|
CLASS="COMMAND"
|
|
>0</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="exitcodes.html#SYSEXITSREF"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>/usr/include/sysexits.h</TT
|
|
></A
|
|
>,
|
|
system file listing C/C++ standard exit codes</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internal.html#EXPORTREF2"
|
|
>Export</A
|
|
>,
|
|
to make available variables to <A
|
|
HREF="othertypesv.html#CHILDREF"
|
|
>child processes</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#EXPORTAWK"
|
|
>Passing a variable
|
|
to an embedded <I
|
|
CLASS="FIRSTTERM"
|
|
>awk</I
|
|
>
|
|
script</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#EXPRREF"
|
|
>expr</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Expression</I
|
|
> evaluator
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#EXPEXTRSUB"
|
|
>Substring
|
|
extraction</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#SUBSTRINGINDEX2"
|
|
>Substring
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>index</I
|
|
> (numerical position in
|
|
string)</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#EXPRMATCH"
|
|
>Substring
|
|
matching</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="x17129.html#EXTREGEX"
|
|
>Extended <I
|
|
CLASS="FIRSTTERM"
|
|
>Regular
|
|
Expressions</I
|
|
></A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>? </B
|
|
> (question mark)
|
|
<A
|
|
HREF="x17129.html#QUEXREGEX"
|
|
>Match zero / one characters</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>( ... ) </B
|
|
>
|
|
<A
|
|
HREF="x17129.html#PARENGRPS"
|
|
>Group
|
|
of expressions</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>\{ N \}</B
|
|
>
|
|
<A
|
|
HREF="x17129.html#ESCPCB"
|
|
><SPAN
|
|
CLASS="QUOTE"
|
|
>"Curly"</SPAN
|
|
> brackets</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>escaped</I
|
|
>,
|
|
number of character sets to match</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>+ </B
|
|
>
|
|
<A
|
|
HREF="x17129.html#PLUSREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Character
|
|
match</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="mathc.html#FACTORREF"
|
|
>factor</A
|
|
>, decomposes an
|
|
integer into its prime factors
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Application: <A
|
|
HREF="mathc.html#PRIMES2"
|
|
>Generating
|
|
prime numbers</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internal.html#FALSEREF"
|
|
>false</A
|
|
>,
|
|
returns <I
|
|
CLASS="FIRSTTERM"
|
|
>unsuccessful</I
|
|
> (1) <A
|
|
HREF="exit-status.html#EXITSTATUSREF"
|
|
>exit status</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#FIELDREF"
|
|
>Field</A
|
|
>, a group of characters
|
|
that comprises an item of data</P
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html"
|
|
>Files / Archiving</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="io-redirection.html#FDREF"
|
|
>File descriptors</A
|
|
></P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="io-redirection.html#CFD"
|
|
>Closing</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>n<&-</B
|
|
>
|
|
Close input file descriptor <I
|
|
CLASS="FIRSTTERM"
|
|
>n</I
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>0<&-</B
|
|
>,
|
|
<B
|
|
CLASS="COMMAND"
|
|
><&-</B
|
|
>
|
|
Close <TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>n>&-</B
|
|
>
|
|
Close output file descriptor <I
|
|
CLASS="FIRSTTERM"
|
|
>n</I
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>1>&-</B
|
|
>,
|
|
<B
|
|
CLASS="COMMAND"
|
|
>>&-</B
|
|
>
|
|
Close <TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="io-redirection.html#FDREF1"
|
|
>File handles in
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>C</I
|
|
></A
|
|
>, similarity to</P
|
|
></LI
|
|
></UL
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#OPENSSLREF"
|
|
>File encryption</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#FINDREF"
|
|
>find</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>{} </B
|
|
>
|
|
<A
|
|
HREF="moreadv.html#CURLYBRACKETSREF"
|
|
>Curly
|
|
brackets</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>\; </B
|
|
>
|
|
<A
|
|
HREF="moreadv.html#FINDREF0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Escaped</I
|
|
>
|
|
semicolon</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#FILTERDEF"
|
|
>Filter</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#FILTERDASH"
|
|
>Using <SPAN
|
|
CLASS="TOKEN"
|
|
>-</SPAN
|
|
>
|
|
with file-processing utility as a filter</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#FILTEROUTP"
|
|
> Feeding output of a filter back to <EM
|
|
>same</EM
|
|
>
|
|
filter</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="ops.html#NOFLOATINGPOINT"
|
|
>Floating point numbers</A
|
|
>,
|
|
Bash does not recognize</P
|
|
><P
|
|
><A
|
|
HREF="textproc.html#FOLDREF"
|
|
>fold</A
|
|
>, a filter to wrap lines of
|
|
text</P
|
|
><P
|
|
><A
|
|
HREF="internal.html#FORKREF"
|
|
>Forking</A
|
|
> a <I
|
|
CLASS="FIRSTTERM"
|
|
>child</I
|
|
>
|
|
process</P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#FORLOOPREF1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>for</I
|
|
>
|
|
loops</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="functions.html#FUNCTIONREF"
|
|
>Functions</A
|
|
></P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#PASSEDARGS"
|
|
>Arguments
|
|
passed</A
|
|
> referred to by position</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#CAPTURERETVAL"
|
|
>Capturing
|
|
the return value</A
|
|
> of a function
|
|
using <A
|
|
HREF="internal.html#ECHOREF"
|
|
>echo</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#COLONFNAME"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Colon</I
|
|
></A
|
|
>
|
|
as function name</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="functions.html#FUNCTDEFMUST"
|
|
>Definition
|
|
must precede</A
|
|
> first call to function</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#EXITRETURN1"
|
|
>Exit
|
|
status</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="localvar.html#LOCALREF1"
|
|
>Local variables</A
|
|
></P
|
|
><P
|
|
>and <A
|
|
HREF="localvar.html#LOCVARRECUR"
|
|
>recursion</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#PASSARRAY"
|
|
>Passing
|
|
an <I
|
|
CLASS="FIRSTTERM"
|
|
>array</I
|
|
></A
|
|
> to a
|
|
function</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#FUNCPOINTERS"
|
|
>Passing pointers</A
|
|
>
|
|
to a function</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#PASSEDARGS"
|
|
>Positional
|
|
parameters</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="localvar.html#RECURSIONREF0"
|
|
>Recursion</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#REDSTDINFUNC1"
|
|
>Redirecting
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
></A
|
|
>
|
|
of a function</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#RETURNREF"
|
|
>return</A
|
|
></P
|
|
><P
|
|
>Multiple <I
|
|
CLASS="FIRSTTERM"
|
|
>return values</I
|
|
> from
|
|
a function,
|
|
<A
|
|
HREF="contributed-scripts.html#STDDEV"
|
|
>example script</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#RETARRAY"
|
|
> Returning an <I
|
|
CLASS="FIRSTTERM"
|
|
>array</I
|
|
></A
|
|
> from
|
|
a function</P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#RVT"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Return</I
|
|
>
|
|
range limits</A
|
|
>, workarounds</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#FSHIFTREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Shift</I
|
|
>
|
|
arguments passed</A
|
|
> to a function</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="functions.html#FSTRANGEREF"
|
|
>Unusual function
|
|
names</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
>Games and amusements
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#AGRAM"
|
|
>Anagrams</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="commandsub.html#AGRAM2"
|
|
>Anagrams</A
|
|
>, again</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#BINGO"
|
|
>Bingo Number Generator</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="textproc.html#CWSOLVER"
|
|
>Crossword puzzle
|
|
solver</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="textproc.html#CRYPTOQUOTE"
|
|
>Crypto-Quotes</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="bashver2.html#CARDS"
|
|
>Dealing a deck of cards</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#FIFTEEN"
|
|
>Fifteen Puzzle</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="colorizing.html#HORSERACE"
|
|
>Horse race</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#KTOUR"
|
|
>Knight's Tour</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#LIFESLOW"
|
|
><SPAN
|
|
CLASS="QUOTE"
|
|
>"Life"</SPAN
|
|
>
|
|
game</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#MSQUARE"
|
|
>Magic Squares</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="devref1.html#MUSICSCR"
|
|
>Music-playing
|
|
script</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#NIM"
|
|
>Nim</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="randomvar.html#BROWNIAN"
|
|
>Pachinko</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#QKY"
|
|
>Perquackey</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#PETALS"
|
|
>Petals Around the Rose</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#BASHPODDER"
|
|
>Podcasting</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#POEM"
|
|
>Poem</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="wrapper.html#SPEECH00"
|
|
>Speech
|
|
generation</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="recurnolocvar.html#HANOI"
|
|
>Towers of Hanoi</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#HANOI2"
|
|
>Graphic
|
|
version</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#HANOI2A"
|
|
>Alternate graphic
|
|
version</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#GETOPTY"
|
|
>getopt</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>external</I
|
|
> command for parsing script
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>command-line</I
|
|
> arguments
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#GETOPTSIMPLE1"
|
|
>Emulated
|
|
in a script</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internal.html#GETOPTSX"
|
|
>getopts</A
|
|
>,
|
|
Bash <I
|
|
CLASS="FIRSTTERM"
|
|
>builtin</I
|
|
> for parsing script
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>command-line</I
|
|
> arguments
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#GETOPTSOPT"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$OPTIND</TT
|
|
> /
|
|
<TT
|
|
CLASS="VARNAME"
|
|
>$OPTARG</TT
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="subshells.html#SCOPEREF"
|
|
>Global</A
|
|
>
|
|
variable</P
|
|
><P
|
|
><A
|
|
HREF="globbingref.html#GLOBBINGREF2"
|
|
>Globbing</A
|
|
>,
|
|
filename expansion
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="globbingref.html#HANDLINGFNAMES"
|
|
>Handling
|
|
filenames correctly</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#ASTERISKREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Wild
|
|
cards</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="globbingref.html#WDOTFILEWC"
|
|
>Will not match
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>dot files</TT
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="mathc.html#GOLDENRATIO"
|
|
>Golden Ratio</A
|
|
>
|
|
(<I
|
|
CLASS="FIRSTTERM"
|
|
>Phi</I
|
|
>)</P
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#GE0REF"
|
|
> -ge </A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>greater-than or equal</I
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#ICOMPARISON1"
|
|
>integer comparison</A
|
|
> test</P
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#GT0REF"
|
|
> -gt </A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>greater-than</I
|
|
> <A
|
|
HREF="comparison-ops.html#ICOMPARISON1"
|
|
>integer
|
|
comparison</A
|
|
> test</P
|
|
><P
|
|
><A
|
|
HREF="textproc.html#GROFFREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>groff</I
|
|
></A
|
|
>,
|
|
text markup and formatting language</P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#GRONSFELD"
|
|
>Gronsfeld cipher</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#GROUPSREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$GROUPS</TT
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Groups</I
|
|
> user belongs to</P
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#GZIPREF"
|
|
>gzip</A
|
|
>, compression utility</P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="internal.html#HASHREF"
|
|
>Hashing</A
|
|
>, creating lookup keys
|
|
in a table
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#HASHEX2_0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Example
|
|
script</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="textproc.html#HEADREF"
|
|
>head</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>echo</I
|
|
>
|
|
to <TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
> lines at the beginning of a text
|
|
file</P
|
|
><P
|
|
><A
|
|
HREF="internal.html#HELPREF"
|
|
>help</A
|
|
>, gives usage summary of
|
|
a Bash <A
|
|
HREF="internal.html#BUILTINREF"
|
|
>builtin</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#HEREDOCREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Here</I
|
|
>
|
|
documents</A
|
|
>
|
|
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#ANONHEREDOC0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Anonymous</I
|
|
>
|
|
here documents</A
|
|
>, using <B
|
|
CLASS="COMMAND"
|
|
>:</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#CBLOCK1"
|
|
>Commenting out</A
|
|
>
|
|
blocks of code</P
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#HSELFDOC"
|
|
>Self-documenting</A
|
|
>
|
|
scripts</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="mathc.html#BCHEREDOC"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>bc</I
|
|
> in a <I
|
|
CLASS="FIRSTTERM"
|
|
>here
|
|
document</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#CATSCRIPTREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>cat</I
|
|
>
|
|
scripts</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#HERECS"
|
|
>Command
|
|
substitution</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#EXSCRIPTREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>ex</I
|
|
>
|
|
scripts</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#HEREFUNC"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Function</I
|
|
></A
|
|
>,
|
|
supplying input to</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17837.html#HERESTRINGSREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Here</I
|
|
>
|
|
strings</A
|
|
></P
|
|
><P
|
|
>Calculating the <A
|
|
HREF="mathc.html#GOLDENRATIO"
|
|
>Golden
|
|
Ratio</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="x17837.html#HSPRE"
|
|
>Prepending text</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="x17837.html#HSLOOP"
|
|
>As the <TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
> of a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>loop</I
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="x17837.html#HSREAD"
|
|
>Using
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>read</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#LIMITSTRINGREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Limit</I
|
|
>
|
|
string</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#EXCLLS"
|
|
><SPAN
|
|
CLASS="TOKEN"
|
|
>!</SPAN
|
|
> as a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>limit string</I
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#INDENTEDLS"
|
|
>Closing <I
|
|
CLASS="FIRSTTERM"
|
|
>limit
|
|
string</I
|
|
></A
|
|
> may not be indented</P
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#LIMITSTRDASH"
|
|
>Dash option</A
|
|
>
|
|
to limit string, <TT
|
|
CLASS="OPTION"
|
|
><<-LimitString</TT
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#HERELIT"
|
|
>Literal
|
|
text output</A
|
|
>,
|
|
for generating program code</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#HEREPARAMSUB"
|
|
>Parameter
|
|
substitution</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#HEREESC"
|
|
>Disabling</A
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>parameter substitution</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#HEREPASSP"
|
|
>Passing
|
|
parameters</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#HERETEMP"
|
|
>Temporary
|
|
files</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#VIHERE"
|
|
>Using
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>vi</I
|
|
> non-interactively</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="histcommands.html"
|
|
>History commands</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#HOMEDIRREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$HOME</TT
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>user's home directory</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#HOMEWORK"
|
|
>Homework assignment solver</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#HOSTNAMEREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$HOSTNAME</TT
|
|
></A
|
|
>,
|
|
system <I
|
|
CLASS="FIRSTTERM"
|
|
>host name</I
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#RCSREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$Id</TT
|
|
>
|
|
parameter</A
|
|
>, in <I
|
|
CLASS="FIRSTTERM"
|
|
>rcs</I
|
|
> (Revision Control
|
|
System)</P
|
|
><P
|
|
><A
|
|
HREF="tests.html#IFTHEN"
|
|
>if [ condition ]; then ...</A
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>test</I
|
|
> construct
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="testconstructs.html#IFGREPREF"
|
|
>if-grep</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>if</I
|
|
> and <A
|
|
HREF="textproc.html#GREPREF"
|
|
>grep</A
|
|
>
|
|
in combination</P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#IFGREPFIX"
|
|
>Fixup</A
|
|
>
|
|
for <I
|
|
CLASS="FIRSTTERM"
|
|
>if-grep</I
|
|
> test</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#IFSREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$IFS</TT
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Internal field separator</I
|
|
> variable
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#IFSWS"
|
|
>Defaults to
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>whitespace</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#ICOMPARISON1"
|
|
>Integer comparison
|
|
operators</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#DOINREF"
|
|
>in</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>keyword</I
|
|
> preceding
|
|
<TT
|
|
CLASS="VARNAME"
|
|
>[list]</TT
|
|
> in a <I
|
|
CLASS="FIRSTTERM"
|
|
>for</I
|
|
>
|
|
loop</P
|
|
><P
|
|
><A
|
|
HREF="system.html#INITTABREF"
|
|
>Initialization table</A
|
|
>,
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/etc/inittab</TT
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#CODEBLOCKREF"
|
|
>Inline group</A
|
|
>,
|
|
i.e., code block</P
|
|
><P
|
|
><A
|
|
HREF="intandnonint.html#IITEST"
|
|
>Interactive script</A
|
|
>, test for</P
|
|
><P
|
|
><A
|
|
HREF="io-redirection.html#IOREDIRREF"
|
|
>I/O redirection</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="ivr.html#IVRREF"
|
|
>Indirect referencing of variables</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="ivr.html#IVR2"
|
|
>New notation</A
|
|
>, introduced
|
|
in <A
|
|
HREF="bashver2.html#BASH2REF"
|
|
>version 2</A
|
|
> of Bash (<A
|
|
HREF="bashver2.html#VARREFNEW"
|
|
> example script</A
|
|
>)</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="system.html#IPTABLESREF"
|
|
>iptables</A
|
|
>,
|
|
packet filtering and firewall utility
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="system.html#IPTABLES01"
|
|
>Usage
|
|
example</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="networkprogramming.html#IPTABLES02"
|
|
>Example
|
|
script</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#ITERATIONREF"
|
|
>Iteration</A
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="x9644.html#JOBIDTABLE0"
|
|
>Job IDs</A
|
|
>, table</P
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#JOTREF"
|
|
>jot</A
|
|
>,
|
|
Emit a sequence of integers. Equivalent to <A
|
|
HREF="extmisc.html#SEQREF"
|
|
>seq</A
|
|
>.
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#JOTRANDOM"
|
|
>Random sequence
|
|
generation</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="textproc.html#JABH"
|
|
>Just another Bash hacker!</A
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="internal.html#KEYWORDREF"
|
|
>Keywords</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="debugging.html#MISSINGKEYWORD"
|
|
>error</A
|
|
>,
|
|
if missing</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="x9644.html#KILLREF"
|
|
>kill</A
|
|
>,
|
|
terminate a process by <A
|
|
HREF="special-chars.html#PROCESSIDDEF"
|
|
>process ID</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x9644.html#ZOMBIEREF"
|
|
>Options</A
|
|
> (<TT
|
|
CLASS="OPTION"
|
|
>-l</TT
|
|
>,
|
|
<TT
|
|
CLASS="OPTION"
|
|
>-9</TT
|
|
>)</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="x9644.html#KILLALLREF"
|
|
>killall</A
|
|
>,
|
|
terminate a process <EM
|
|
>by name</EM
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="sysscripts.html#KILLALL2REF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>killall
|
|
script</I
|
|
></A
|
|
> in <TT
|
|
CLASS="FILENAME"
|
|
>/etc/rc.d/init.d</TT
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#LASTPIPEREF"
|
|
>lastpipe</A
|
|
> shell
|
|
option</P
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#LE0REF"
|
|
> -le </A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>less-than or equal</I
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#ICOMPARISON1"
|
|
>integer comparison</A
|
|
> test</P
|
|
><P
|
|
><A
|
|
HREF="internal.html#LETREF"
|
|
>let</A
|
|
>,
|
|
setting and carrying out arithmetic operations on variables
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>C-style</I
|
|
>
|
|
<A
|
|
HREF="internal.html#EX46"
|
|
>increment and decrement
|
|
operators</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#LIMITSTRINGREF"
|
|
>Limit string</A
|
|
>,
|
|
in a <A
|
|
HREF="here-docs.html#HEREDOCREF"
|
|
>here document</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#LINENOREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$LINENO</TT
|
|
></A
|
|
>,
|
|
variable indicating the <I
|
|
CLASS="FIRSTTERM"
|
|
>line number</I
|
|
> where
|
|
it appears in a script</P
|
|
><P
|
|
><A
|
|
HREF="basic.html#LINKREF"
|
|
>Link</A
|
|
>, file
|
|
(using <I
|
|
CLASS="FIRSTTERM"
|
|
>ln</I
|
|
> command)
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="basic.html#LINKMINVOK"
|
|
>Invoking script with multiple names</A
|
|
>,
|
|
using <I
|
|
CLASS="FIRSTTERM"
|
|
>ln</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="basic.html#SYMLINKREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>symbolic</I
|
|
>
|
|
links</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>ln -s </I
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="list-cons.html#LISTCONSREF"
|
|
>List constructs</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="list-cons.html#LCONS1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>And</I
|
|
>
|
|
list</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="list-cons.html#ORLISTREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Or</I
|
|
>
|
|
list</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="localvar.html#LOCALREF1"
|
|
>Local variables</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>and <A
|
|
HREF="localvar.html#LOCVARRECUR"
|
|
>recursion</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="localization.html"
|
|
>Localization</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="ops.html#LOGOPS1"
|
|
>Logical operators</A
|
|
>
|
|
(<TT
|
|
CLASS="VARNAME"
|
|
>&&</TT
|
|
>, <TT
|
|
CLASS="VARNAME"
|
|
>||</TT
|
|
>,
|
|
etc.)</P
|
|
><P
|
|
><A
|
|
HREF="files.html#LOGOUTFILEREF1"
|
|
>Logout file</A
|
|
>,
|
|
the <TT
|
|
CLASS="FILENAME"
|
|
>~/.bash_logout</TT
|
|
> file</P
|
|
><P
|
|
><A
|
|
HREF="system.html#ISOMOUNTREF0"
|
|
>Loopback device</A
|
|
>,
|
|
mounting a file on a <A
|
|
HREF="devref1.html#BLOCKDEVREF"
|
|
>block
|
|
device</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html"
|
|
>Loops</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loopcontrol.html#BRKCONT1"
|
|
>break</A
|
|
>
|
|
loop control command</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loopcontrol.html#BRKCONT1"
|
|
>continue</A
|
|
> loop
|
|
control command</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>C</I
|
|
>-style
|
|
loop within <A
|
|
HREF="dblparens.html#DBLPARENSREF"
|
|
>double
|
|
parentheses</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#LOOPCSTYLE"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>for</I
|
|
> loop</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WLOOPCSTYLE"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>while</I
|
|
> loop</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#DOINREF"
|
|
>do</A
|
|
> (keyword),
|
|
begins execution of commands within a loop</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#DOINREF"
|
|
>done</A
|
|
> (keyword),
|
|
terminates a loop</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#FORLOOPREF1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>for</I
|
|
>
|
|
loops</A
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>for</I
|
|
></TT
|
|
> <TT
|
|
CLASS="VARNAME"
|
|
>arg</TT
|
|
>
|
|
<TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>in</I
|
|
></TT
|
|
> <TT
|
|
CLASS="VARNAME"
|
|
>[list]</TT
|
|
>;
|
|
<TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>do</I
|
|
></TT
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#LOOPCS"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Command
|
|
substitution</I
|
|
> to generate
|
|
<TT
|
|
CLASS="VARNAME"
|
|
>[list]</TT
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#LIGLOB"
|
|
>Filename expansion
|
|
in <TT
|
|
CLASS="VARNAME"
|
|
>[list]</TT
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#MULTPARAML"
|
|
>Multiple parameters
|
|
in each <TT
|
|
CLASS="VARNAME"
|
|
>[list]</TT
|
|
> element</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#OMITLIST"
|
|
>Omitting
|
|
<TT
|
|
CLASS="VARNAME"
|
|
>[list]</TT
|
|
></A
|
|
>, defaults to
|
|
<A
|
|
HREF="internalvariables.html#POSPARAMREF"
|
|
>positional parameters</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#PARAMLI"
|
|
>Parameterizing
|
|
<TT
|
|
CLASS="VARNAME"
|
|
>[list]</TT
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#LOOPREDIR"
|
|
>Redirection</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#DOINREF"
|
|
>in</A
|
|
>,
|
|
(keyword) preceding [list] in a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>for</I
|
|
> loop</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="nestedloops.html"
|
|
>Nested
|
|
loops</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#BGLOOP0"
|
|
>Running a
|
|
loop <EM
|
|
>in the background</EM
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>script example</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Semicolon required, when <I
|
|
CLASS="FIRSTTERM"
|
|
>do</I
|
|
> is on first line
|
|
of loop</P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#NEEDSEMICOLON"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>for</I
|
|
>
|
|
loop</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHILENEEDSEMI"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>while</I
|
|
>
|
|
loop</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#UNTILLOOPREF"
|
|
>until</A
|
|
> loop</P
|
|
><P
|
|
><TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>until [ condition-is-true ]; do</I
|
|
></TT
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHILELOOPREF"
|
|
>while</A
|
|
>
|
|
loop</P
|
|
><P
|
|
><TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>while [ condition ]; do</I
|
|
></TT
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHILEFUNC"
|
|
>Function call</A
|
|
>
|
|
inside test brackets</P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHMULTCOND"
|
|
>Multiple conditions</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHILENOBRACKETS"
|
|
>Omitting <I
|
|
CLASS="FIRSTTERM"
|
|
>test
|
|
brackets</I
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHREDIR"
|
|
>Redirection</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHILEREADREF2"
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>while read</I
|
|
></A
|
|
> construct</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#CHOOSELOOP"
|
|
>Which type of loop to
|
|
use</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>Loopback devices
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="devref1.html#LOOPBACKREF"
|
|
>In <TT
|
|
CLASS="FILENAME"
|
|
>/dev</TT
|
|
> directory</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="system.html#ISOMOUNTREF0"
|
|
>Mounting an ISO image</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#LT0REF"
|
|
> -lt </A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>less-than</I
|
|
> <A
|
|
HREF="comparison-ops.html#ICOMPARISON1"
|
|
>integer
|
|
comparison</A
|
|
> test</P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#M4REF"
|
|
>m4</A
|
|
>, macro processing language</P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#MACHTYPEREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$MACHTYPE</TT
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Machine type</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="sha-bang.html#MAGNUMREF"
|
|
>Magic number</A
|
|
>,
|
|
marker at the head of a file indicating the file type</P
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#MAKEFILEREF"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>Makefile</TT
|
|
></A
|
|
>,
|
|
file containing the list of dependencies used by <A
|
|
HREF="filearchiv.html#MAKEREF"
|
|
>make</A
|
|
> command</P
|
|
><P
|
|
><A
|
|
HREF="basic.html#MANREF"
|
|
>man</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>manual
|
|
page</I
|
|
> (lookup)
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#MANED"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Man page</I
|
|
>
|
|
editor</A
|
|
> (script)</P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#MAPFILEREF"
|
|
>mapfile</A
|
|
> builtin,
|
|
loads an array with a text file</P
|
|
><P
|
|
><A
|
|
HREF="mathc.html"
|
|
>Math commands</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="x17129.html#METAMEANINGREF"
|
|
>Meta-meaning</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#SAMORSE"
|
|
>Morse code training</A
|
|
> script</P
|
|
><P
|
|
><A
|
|
HREF="ops.html#MODULOREF"
|
|
>Modulo</A
|
|
>, arithmetic
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>remainder</I
|
|
> operator
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Application: <A
|
|
HREF="contributed-scripts.html#PRIMES1"
|
|
>Generating
|
|
prime numbers</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="mathc.html#MONTHLYPMT0"
|
|
>Mortgage calculations</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>example script</I
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-n </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#STRINGNOTNULL"
|
|
>String not
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>null</I
|
|
></A
|
|
> test</P
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#NAMEDPIPEREF"
|
|
>Named pipe</A
|
|
>, a temporary
|
|
FIFO buffer
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#ZFIFO"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Example
|
|
script</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="system.html#NCREF"
|
|
>nc</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>netcat</I
|
|
>,
|
|
a network toolkit for TCP and UDP ports</P
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#NEQUALREF"
|
|
>-ne</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>not-equal-to</I
|
|
> <A
|
|
HREF="comparison-ops.html#ICOMPARISON1"
|
|
>integer comparison</A
|
|
> test</P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#NOTREF"
|
|
>Negation operator</A
|
|
>,
|
|
<B
|
|
CLASS="COMMAND"
|
|
>!</B
|
|
>, reverses the sense of a <A
|
|
HREF="tests.html#IFTHEN"
|
|
>test</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="system.html#NETSTATREF"
|
|
>netstat</A
|
|
>, Network
|
|
statistics</P
|
|
><P
|
|
><A
|
|
HREF="networkprogramming.html"
|
|
>Network programming</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="textproc.html#NLREF"
|
|
>nl</A
|
|
>, a filter to number lines of
|
|
text</P
|
|
><P
|
|
><A
|
|
HREF="options.html#NOCLOBBERREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Noclobber</I
|
|
></A
|
|
>,
|
|
<TT
|
|
CLASS="OPTION"
|
|
>-C</TT
|
|
> option to Bash to prevent overwriting
|
|
of files</P
|
|
><P
|
|
><A
|
|
HREF="ops.html#LOGOPS1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>NOT</I
|
|
> logical
|
|
operator</A
|
|
>, <B
|
|
CLASS="COMMAND"
|
|
>!</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#NULLVAR"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>null</I
|
|
> variable
|
|
assignment</A
|
|
>, avoiding</P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-o </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#COMPOUNDOR"
|
|
>Logical OR</A
|
|
>
|
|
compound comparison test</P
|
|
><P
|
|
>Obfuscation
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#COLONFNAME"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Colon</I
|
|
></A
|
|
>
|
|
as function name</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#HOMEWORK"
|
|
>Homework assignment</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="textproc.html#JABH"
|
|
>Just another Bash
|
|
hacker!</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="escapingsection.html#OCTALREF"
|
|
>octal</A
|
|
>, base-8 numbers</P
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#ODREF"
|
|
>od</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>octal
|
|
dump</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#OLDPWD"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$OLDPWD</TT
|
|
></A
|
|
>
|
|
Previous working directory</P
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#OPENSSLREF"
|
|
>openssl</A
|
|
> encryption
|
|
utility</P
|
|
><P
|
|
>Operator
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#OPERATORDEF"
|
|
>Definition
|
|
of</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="opprecedence.html#OPPRECEDENCE1"
|
|
>Precedence</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="options.html#OPTIONSREF"
|
|
>Options</A
|
|
>,
|
|
passed to shell or script on command line or by <A
|
|
HREF="internal.html#SETREF"
|
|
>set</A
|
|
> command</P
|
|
><P
|
|
><A
|
|
HREF="list-cons.html#ORLISTREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Or</I
|
|
>
|
|
list</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="ops.html#ORREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Or</I
|
|
> logical
|
|
operator</A
|
|
>, <B
|
|
CLASS="COMMAND"
|
|
>||</B
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PARAMSUBREF"
|
|
>Parameter
|
|
substitution</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>${parameter+alt_value}</I
|
|
></P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>${parameter:+alt_value}</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PARAMALTV"
|
|
>Alternate value</A
|
|
>
|
|
of parameter, if set</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>${parameter-default}</I
|
|
></P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>${parameter:-default}</I
|
|
></P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>${parameter=default}</I
|
|
></P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>${parameter:=default}</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#DEFPARAM1"
|
|
>Default
|
|
parameters</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>${!varprefix*}</I
|
|
></P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>${!varprefix@}</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#VARPREFIXM"
|
|
>Parameter
|
|
<EM
|
|
>name</EM
|
|
> match</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>${parameter?err_msg}</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#QERRMSG"
|
|
>Parameter-unset message</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>${parameter}</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PSSUB1"
|
|
>Value of
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>parameter</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#CASEMODPARAMSUB"
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>Case modification</I
|
|
></A
|
|
>
|
|
(<A
|
|
HREF="bashver4.html#BASH4REF"
|
|
>version 4+</A
|
|
> of
|
|
Bash).</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#PW0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Script
|
|
example</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="refcards.html#PARSUBTAB"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>Table</B
|
|
></A
|
|
>
|
|
of <I
|
|
CLASS="FIRSTTERM"
|
|
>parameter
|
|
substitution</I
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#PARCHILDPROBREF"
|
|
>Parent / child process
|
|
problem</A
|
|
>, a <I
|
|
CLASS="FIRSTTERM"
|
|
>child</I
|
|
> process cannot
|
|
<A
|
|
HREF="internal.html#EXPORTREF"
|
|
>export</A
|
|
> variables to a <A
|
|
HREF="internal.html#FORKREF"
|
|
>parent process</A
|
|
></P
|
|
><P
|
|
>Parentheses
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#PARENSREF"
|
|
>Command
|
|
group</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17129.html#PARENGRPS"
|
|
>Enclose group</A
|
|
>
|
|
of <I
|
|
CLASS="FIRSTTERM"
|
|
>Extended Regular
|
|
Expressions</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="dblparens.html#DBLPARENSREF"
|
|
>Double parentheses</A
|
|
>,
|
|
in arithmetic expansion</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#PATHREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$PATH</TT
|
|
></A
|
|
>,
|
|
the <I
|
|
CLASS="FIRSTTERM"
|
|
>path</I
|
|
> (location of system
|
|
binaries)
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Appending directories to <TT
|
|
CLASS="VARNAME"
|
|
>$PATH</TT
|
|
>
|
|
<A
|
|
HREF="bashver3.html#PATHAPPEND"
|
|
>using the <TT
|
|
CLASS="VARNAME"
|
|
>+=</TT
|
|
>
|
|
operator</A
|
|
>.</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#PATHNAMEREF"
|
|
>Pathname</A
|
|
>,
|
|
a <TT
|
|
CLASS="FILENAME"
|
|
>filename</TT
|
|
> that incorporates the complete
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>path</I
|
|
> of a given file.
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="pathmanagement.html"
|
|
>Parsing
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>pathnames</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="wrapper.html#PERLREF"
|
|
>Perl</A
|
|
>, programming language
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="wrapper.html#BASHANDPERL0"
|
|
>Combined</A
|
|
> in the
|
|
same file with a <I
|
|
CLASS="FIRSTTERM"
|
|
>Bash</I
|
|
> script</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="wrapper.html#PERLEMB"
|
|
>Embedded</A
|
|
> in a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Bash</I
|
|
> script</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#QKY"
|
|
><EM
|
|
>Perquackey</EM
|
|
>-type
|
|
anagramming game</A
|
|
> (<EM
|
|
>Quackey</EM
|
|
> script)</P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#PETALS"
|
|
><EM
|
|
>Petals Around the
|
|
Rose</EM
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#PROCESSIDDEF"
|
|
>PID</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Process ID</I
|
|
>, an identification
|
|
number assigned to a running process.</P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#PIPEREF"
|
|
>Pipe</A
|
|
>, <B
|
|
CLASS="COMMAND"
|
|
>| </B
|
|
>,
|
|
a device for passing the output of a command to another command
|
|
or to the shell
|
|
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="optimizations.html#CATABUSE"
|
|
>Avoiding
|
|
unnecessary commands</A
|
|
> in a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>pipe</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#COMMINPIPE"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Comments</I
|
|
> embedded
|
|
within</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="exit-status.html#PIPEEX"
|
|
>Exit status</A
|
|
>
|
|
of a pipe</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="bashver3.html#PIPEFAILREF"
|
|
>Pipefail</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>set -o pipefail</I
|
|
>
|
|
option to indicate <A
|
|
HREF="exit-status.html#EXITSTATUSREF"
|
|
>exit status</A
|
|
>
|
|
within a <I
|
|
CLASS="FIRSTTERM"
|
|
>pipe</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#PIPESTATUSREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$PIPESTATUS</TT
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>exit status</I
|
|
> of last executed
|
|
pipe</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#UCREF"
|
|
>Piping output of a command</A
|
|
>
|
|
to a script</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="basic.html#CATLESSEFF"
|
|
>Redirecting
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
></A
|
|
>, rather than using
|
|
<A
|
|
HREF="basic.html#CATREF"
|
|
>cat</A
|
|
> in a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>pipe</I
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="gotchas.html"
|
|
>Pitfalls</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#DASHNREDR"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-</B
|
|
>
|
|
(dash) is <EM
|
|
>not</EM
|
|
> redirection
|
|
operator</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#DOUBLESLASHREF"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>//
|
|
</B
|
|
> (double forward slash)</A
|
|
>, behavior of <A
|
|
HREF="internal.html#CDREF"
|
|
>cd</A
|
|
> command toward</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#BINSH"
|
|
><SPAN
|
|
CLASS="TOKEN"
|
|
>#!/bin/sh</SPAN
|
|
></A
|
|
>
|
|
script header disables <A
|
|
HREF="portabilityissues.html#BASHCOMPAT"
|
|
>extended <I
|
|
CLASS="FIRSTTERM"
|
|
>Bash</I
|
|
>
|
|
features</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="optimizations.html#CATABUSE"
|
|
>Abuse of
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>cat</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#CGIREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>CGI</I
|
|
>
|
|
programming</A
|
|
>, using scripts for</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Closing <I
|
|
CLASS="FIRSTTERM"
|
|
>limit string</I
|
|
>
|
|
in a <I
|
|
CLASS="FIRSTTERM"
|
|
>here document</I
|
|
>,
|
|
<A
|
|
HREF="here-docs.html#INDENTEDLS"
|
|
>indenting</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#DOSNEWLINES"
|
|
>DOS-type newlines
|
|
(<SPAN
|
|
CLASS="TOKEN"
|
|
>\r\n</SPAN
|
|
>)</A
|
|
> crash a script</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="quotingvar.html#QUOTINGBSL"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Double-quoting</I
|
|
>
|
|
the <I
|
|
CLASS="FIRSTTERM"
|
|
>backslash</I
|
|
> (<B
|
|
CLASS="COMMAND"
|
|
>\</B
|
|
>)
|
|
character</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#EVALRISK"
|
|
>eval</A
|
|
>, risk of
|
|
using</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#EXECPERM"
|
|
>Execute permission
|
|
lacking</A
|
|
> for commands within a script</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>Exit status</I
|
|
>,
|
|
<A
|
|
HREF="gotchas.html#GOTCHAEXITVALANAMALIES"
|
|
>anomalous</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>Exit status</I
|
|
>
|
|
<A
|
|
HREF="gotchas.html#ARXS1"
|
|
>of arithmetic expression <EM
|
|
>not</EM
|
|
>
|
|
equivalent to an <I
|
|
CLASS="FIRSTTERM"
|
|
>error code</I
|
|
></A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#PARCHILDPROBREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Export</I
|
|
>
|
|
problem</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>child</I
|
|
> process
|
|
to <I
|
|
CLASS="FIRSTTERM"
|
|
>parent</I
|
|
> process</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#LATEVERF"
|
|
>Extended
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Bash</I
|
|
> features</A
|
|
> not
|
|
available</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#FAILQUOTE"
|
|
>Failing to
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>quote</I
|
|
> variables</A
|
|
>
|
|
within <I
|
|
CLASS="FIRSTTERM"
|
|
>test</I
|
|
> brackets</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#GNUREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>GNU</I
|
|
>
|
|
command set</A
|
|
>, in cross-platform scripts</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>let</I
|
|
> misuse:
|
|
<A
|
|
HREF="gotchas.html#LETBAD"
|
|
>attempting to set string variables</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#RVTCAUTION2"
|
|
>Multiple echo
|
|
statements</A
|
|
> in a <A
|
|
HREF="assortedtips.html#RVT"
|
|
>function whose
|
|
output is captured</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#NULLVAR"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>null</I
|
|
>
|
|
variable assignment</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#NUMSTRCOMPNE"
|
|
>Numerical and string
|
|
comparison operators</A
|
|
> <EM
|
|
>not</EM
|
|
>
|
|
equivalent</P
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#EQDIF"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>=</B
|
|
>
|
|
and <B
|
|
CLASS="COMMAND"
|
|
>-eq</B
|
|
></A
|
|
> <EM
|
|
>not</EM
|
|
>
|
|
interchangeable</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#OMITSEMICOLON"
|
|
>Omitting
|
|
terminal <I
|
|
CLASS="FIRSTTERM"
|
|
>semicolon</I
|
|
></A
|
|
>,
|
|
in a <I
|
|
CLASS="FIRSTTERM"
|
|
>curly-bracketed</I
|
|
> <A
|
|
HREF="special-chars.html#CODEBLOCKREF"
|
|
>code block</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Piping</P
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#PIPELOOP"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>echo</I
|
|
>
|
|
to a loop</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#BADREAD0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>echo</I
|
|
>
|
|
to <I
|
|
CLASS="FIRSTTERM"
|
|
>read</I
|
|
></A
|
|
> (however, this problem
|
|
<A
|
|
HREF="process-sub.html#GOODREAD0"
|
|
>can be circumvented</A
|
|
>)</P
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#PTAILGREP"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>tail</I
|
|
>
|
|
<TT
|
|
CLASS="OPTION"
|
|
>-f</TT
|
|
> to <I
|
|
CLASS="FIRSTTERM"
|
|
>grep</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Preserving <I
|
|
CLASS="FIRSTTERM"
|
|
>whitespace</I
|
|
>
|
|
within a variable, <A
|
|
HREF="quotingvar.html#VARSPLITTING"
|
|
>unintended
|
|
consequences</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#SUIDSCR"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>suid</I
|
|
>
|
|
commands inside a script</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#UNDOCF"
|
|
>Undocumented
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Bash</I
|
|
> features</A
|
|
>,
|
|
danger of</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Updates to <I
|
|
CLASS="FIRSTTERM"
|
|
>Bash</I
|
|
>
|
|
<A
|
|
HREF="gotchas.html#UPDATEBREAKS"
|
|
>breaking older
|
|
scripts</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#UNINITVAR"
|
|
>Uninitialized
|
|
variables</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#INAPPVN"
|
|
>Variable names</A
|
|
>,
|
|
inappropriate</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#VARSUBSH"
|
|
>Variables in a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>subshell</I
|
|
></A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>scope</I
|
|
>
|
|
limited</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#BADREAD0"
|
|
>Subshell in <I
|
|
CLASS="FIRSTTERM"
|
|
>while-read</I
|
|
>
|
|
loop</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#WSBAD"
|
|
>Whitespace</A
|
|
>,
|
|
misuse of</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>Pointers</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="io-redirection.html#FDREF1"
|
|
>and file descriptors</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#FUNCPOINTERS"
|
|
>and functions</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="ivr.html#IRRREF"
|
|
>and <I
|
|
CLASS="FIRSTTERM"
|
|
>indirect
|
|
references</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="varsubn.html#POINTERREF"
|
|
>and
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>variables</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
><P
|
|
><A
|
|
HREF="portabilityissues.html"
|
|
>Portability issues</A
|
|
>
|
|
in shell scripting
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#SETPUM"
|
|
>Setting <I
|
|
CLASS="FIRSTTERM"
|
|
>path</I
|
|
>
|
|
and <I
|
|
CLASS="FIRSTTERM"
|
|
>umask</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="portabilityissues.html#TESTSUITE0"
|
|
>A <I
|
|
CLASS="FIRSTTERM"
|
|
>test suite</I
|
|
>
|
|
script</A
|
|
> (Bash versus classic Bourne
|
|
shell)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#WHATISREF3"
|
|
>Using <I
|
|
CLASS="FIRSTTERM"
|
|
>whatis</I
|
|
></A
|
|
>
|
|
</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#POSPARAMREF1"
|
|
>Positional parameters</A
|
|
>
|
|
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#APPREF2"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$@</TT
|
|
></A
|
|
>,
|
|
as <I
|
|
CLASS="FIRSTTERM"
|
|
>separate</I
|
|
> words</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#APPREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$*</TT
|
|
></A
|
|
>,
|
|
as a <I
|
|
CLASS="FIRSTTERM"
|
|
>single</I
|
|
> word</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#PASSEDARGS"
|
|
>in
|
|
functions</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="sha-bang.html#POSIX2REF"
|
|
><SPAN
|
|
CLASS="ACRONYM"
|
|
>POSIX</SPAN
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>Portable Operating System Interface /
|
|
UNIX</I
|
|
>
|
|
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="portabilityissues.html#POSIX3REF"
|
|
><TT
|
|
CLASS="OPTION"
|
|
>--posix</TT
|
|
>
|
|
option</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="portabilityissues.html#POSIX3REF"
|
|
>1003.2 standard</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17129.html#POSIXREF"
|
|
>Character
|
|
classes</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#PPIDREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$PPID</TT
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>process ID</I
|
|
> of parent process</P
|
|
><P
|
|
><A
|
|
HREF="opprecedence.html#OPPRECEDENCE1"
|
|
>Precedence</A
|
|
>, operator</P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#PREPENDREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Prepending</I
|
|
></A
|
|
>
|
|
lines at head of a file, <I
|
|
CLASS="FIRSTTERM"
|
|
>script
|
|
example</I
|
|
></P
|
|
><P
|
|
>Prime numbers
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Generating primes
|
|
<A
|
|
HREF="mathc.html#PRIMES2"
|
|
>using the <I
|
|
CLASS="FIRSTTERM"
|
|
>factor</I
|
|
>
|
|
command</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Generating primes
|
|
<A
|
|
HREF="contributed-scripts.html#PRIMES1"
|
|
>using the <I
|
|
CLASS="FIRSTTERM"
|
|
>modulo</I
|
|
>
|
|
operator</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Sieve of Eratosthenes, <A
|
|
HREF="arrays.html#PRIMES0"
|
|
>example script</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internal.html#PRINTFREF"
|
|
>printf</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>formatted print</I
|
|
> command</P
|
|
><P
|
|
><A
|
|
HREF="procref1.html#PROCREF2"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>/proc</TT
|
|
></A
|
|
> directory
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="procref1.html#PROCRUNNING"
|
|
>Running processes</A
|
|
>,
|
|
files describing</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="procref1.html#PROCWARNING"
|
|
>Writing to
|
|
files in <TT
|
|
CLASS="FILENAME"
|
|
>/proc</TT
|
|
></A
|
|
>,
|
|
<EM
|
|
>warning</EM
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#PROCESSREF"
|
|
>Process</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#CHILDREF2"
|
|
>Child
|
|
process</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#PARENTREF"
|
|
>Parent
|
|
process</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#PROCESSIDDEF"
|
|
>Process
|
|
ID</A
|
|
> (PID)</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="process-sub.html#PROCESSSUBREF"
|
|
>Process substitution</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="process-sub.html#PCC2DIR"
|
|
>To compare contents of
|
|
directories</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="process-sub.html#PSFDSTDIN"
|
|
>To supply <TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
> of a
|
|
command</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="process-sub.html#COMMANDSPARENS1"
|
|
>Template</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="process-sub.html#GOODREAD0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>while-read</I
|
|
> loop
|
|
without a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>subshell</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="tabexpansion.html"
|
|
>Programmable completion</A
|
|
>
|
|
(tab expansion)</P
|
|
><P
|
|
>Prompt
|
|
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#PS1REF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$PS1</TT
|
|
></A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>Main
|
|
prompt</I
|
|
>, seen at command
|
|
line</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#SECPROMPTREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$PS2</TT
|
|
></A
|
|
>,
|
|
Secondary prompt</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#PSEUDOCODEREF"
|
|
>Pseudo-code</A
|
|
>,
|
|
as problem-solving method</P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#PWDREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$PWD</TT
|
|
></A
|
|
>,
|
|
Current working directory</P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#QKY"
|
|
>Quackey</A
|
|
>, a
|
|
<EM
|
|
>Perquackey</EM
|
|
>-type anagramming game (script)</P
|
|
><P
|
|
>Question mark, <B
|
|
CLASS="COMMAND"
|
|
>? </B
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17129.html#QUEXREGEX"
|
|
>Character
|
|
match</A
|
|
> in an Extended <I
|
|
CLASS="FIRSTTERM"
|
|
>Regular
|
|
Expression</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#QUEXWC"
|
|
>Single-character
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>wild card</I
|
|
></A
|
|
>,
|
|
in <A
|
|
HREF="globbingref.html"
|
|
>globbing</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>In a
|
|
<A
|
|
HREF="special-chars.html#CSTRINARY"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>C</I
|
|
>-style
|
|
Trinary (ternary) operator</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="quoting.html#QUOTINGDEF"
|
|
>Quoting</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="quoting.html#QUOTINGREF"
|
|
>Character
|
|
string</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="quotingvar.html"
|
|
>Variables</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#FAILQUOTE"
|
|
>within <I
|
|
CLASS="FIRSTTERM"
|
|
>test</I
|
|
>
|
|
brackets</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="quotingvar.html#WSQUO"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Whitespace</I
|
|
></A
|
|
>,
|
|
using <I
|
|
CLASS="FIRSTTERM"
|
|
>quoting</I
|
|
> to
|
|
preserve</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
>Random numbers
|
|
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="randomvar.html#URANDOMREF"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>/dev/urandom</TT
|
|
></A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="randomvar.html#AWKRANDOMREF"
|
|
> <TT
|
|
CLASS="VARNAME"
|
|
>rand()</TT
|
|
></A
|
|
>,
|
|
random function in <A
|
|
HREF="awk.html#AWKREF"
|
|
>awk</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="randomvar.html#RANDOMVAR01"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$RANDOM</TT
|
|
></A
|
|
>, Bash
|
|
function that returns a pseudorandom integer</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="timedate.html#DATERANDREF"
|
|
>Random sequence
|
|
generation</A
|
|
>, using <A
|
|
HREF="timedate.html#DATEREF"
|
|
>date</A
|
|
>
|
|
command</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#JOTRANDOM"
|
|
>Random sequence
|
|
generation</A
|
|
>, using <A
|
|
HREF="extmisc.html#JOTREF"
|
|
>jot</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#RANDSTRING0"
|
|
>Random string</A
|
|
>,
|
|
generating</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>Raspberry Pi (single-board computer)
|
|
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#RPSDCARD01"
|
|
>Script for preparing a bootable SD card</A
|
|
>
|
|
</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#RCSREF"
|
|
>rcs</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internal.html#READREF"
|
|
>read</A
|
|
>, set value of a
|
|
variable from <A
|
|
HREF="ioredirintro.html#STDINOUTDEF"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
></A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#READARROW"
|
|
>Detecting
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>arrow</I
|
|
> keys</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#READOPTIONS"
|
|
>Options</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#READPIPEREF"
|
|
>Piping
|
|
output of <I
|
|
CLASS="FIRSTTERM"
|
|
>cat</I
|
|
></A
|
|
>
|
|
to <I
|
|
CLASS="FIRSTTERM"
|
|
>read</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17837.html#HSREAD"
|
|
><SPAN
|
|
CLASS="QUOTE"
|
|
>"Prepending"</SPAN
|
|
>
|
|
text</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#BADREAD0"
|
|
> Problems piping <I
|
|
CLASS="FIRSTTERM"
|
|
>echo</I
|
|
></A
|
|
>
|
|
to <I
|
|
CLASS="FIRSTTERM"
|
|
>read</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#READREDIR0"
|
|
>Redirection from a
|
|
file</A
|
|
> to <I
|
|
CLASS="FIRSTTERM"
|
|
>read</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#REPLYREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$REPLY</TT
|
|
></A
|
|
>,
|
|
default <I
|
|
CLASS="FIRSTTERM"
|
|
>read</I
|
|
> variable</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#READTIMED"
|
|
>Timed
|
|
input</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHILEREADREF2"
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>while read</I
|
|
></A
|
|
>
|
|
construct</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internal.html#READLINEREF"
|
|
>readline</A
|
|
> library</P
|
|
><P
|
|
><A
|
|
HREF="localvar.html#RECURSIONREF"
|
|
>Recursion</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="localvar.html#RECURSIONDEMO0"
|
|
>Demonstration of</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="localvar.html#FACTORIALREF"
|
|
>Factorial</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="recurnolocvar.html#FIBOREF"
|
|
>Fibonacci
|
|
sequence</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="localvar.html#LOCVARRECUR"
|
|
>Local
|
|
variables</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="recursionsct.html#SCRIPTRECURSION"
|
|
>Script
|
|
calling itself recursively</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="recurnolocvar.html#HANOIREF"
|
|
>Towers
|
|
of Hanoi</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>Redirection
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="redircb.html#REDIRREF"
|
|
>Code
|
|
blocks</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17974.html#USINGEXECREF"
|
|
>exec
|
|
<<TT
|
|
CLASS="FILENAME"
|
|
>filename</TT
|
|
></A
|
|
>,</P
|
|
><P
|
|
>to reassign
|
|
<A
|
|
HREF="io-redirection.html#FDREF"
|
|
>file descriptors</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="ioredirintro.html"
|
|
>Introductory-level
|
|
explanation</A
|
|
> of <I
|
|
CLASS="FIRSTTERM"
|
|
>I/O
|
|
redirection</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF2"
|
|
> Open a file</A
|
|
> for <EM
|
|
>both</EM
|
|
>
|
|
reading and writing</P
|
|
><P
|
|
><TT
|
|
CLASS="FILENAME"
|
|
><>filename</TT
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#READREDIR0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>read</I
|
|
>
|
|
input redirected</A
|
|
> from a file</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF1"
|
|
> <TT
|
|
CLASS="FILENAME"
|
|
>stderr</TT
|
|
> to
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></A
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>2>&1 </TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#COXEX"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
> /
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></A
|
|
>,
|
|
using <B
|
|
CLASS="COMMAND"
|
|
> - </B
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#REDSTDINFUNC1"
|
|
> <TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
>of a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>function</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF"
|
|
> <TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
> to a file</A
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>></I
|
|
></TT
|
|
> ... <TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>>></I
|
|
></TT
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF1"
|
|
> <TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
> to
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>file descriptor</I
|
|
></A
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>j</I
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>>&j </TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="io-redirection.html#IOREDIRECTIONREF1"
|
|
> file descriptor<TT
|
|
CLASS="FILENAME"
|
|
>i</TT
|
|
> to
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>file descriptor</I
|
|
></A
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>j</I
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>i>&j </TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="special-chars.html#REDIROUTERROR2"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
>
|
|
of a command</A
|
|
> to <TT
|
|
CLASS="FILENAME"
|
|
>stderr</TT
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>>&2</TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="special-chars.html#REDIROUTERROR"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
>
|
|
<EM
|
|
>and</EM
|
|
> <TT
|
|
CLASS="FILENAME"
|
|
>stderr</TT
|
|
>
|
|
of a command</A
|
|
> to a file</P
|
|
><P
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>&> </TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="extmisc.html#TEEREF"
|
|
>tee</A
|
|
>, redirect to a file
|
|
output of command(s) partway through a <A
|
|
HREF="special-chars.html#PIPEREF"
|
|
>pipe</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="refcards.html"
|
|
>Reference Cards</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="refcards.html#MISCTAB"
|
|
>Miscellaneous
|
|
constructs</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="refcards.html#PARSUBTAB"
|
|
>Parameter
|
|
substitution/expansion</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="refcards.html#SPECSHVARTAB"
|
|
>Special shell
|
|
variables</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="refcards.html#STRINGOPSTAB"
|
|
>String
|
|
operations</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Test operators</P
|
|
><P
|
|
><A
|
|
HREF="refcards.html#BINCOMPTAB"
|
|
>Binary comparison</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="refcards.html#FILESTAB"
|
|
>Files</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="regexp.html#REGEXREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Regular
|
|
Expressions</I
|
|
></A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>^ </B
|
|
> (caret)
|
|
<A
|
|
HREF="special-chars.html#BEGLINEREF"
|
|
>Beginning-of-line</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>$ </B
|
|
> (dollar sign)
|
|
<A
|
|
HREF="x17129.html#DOLLARSIGNREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Anchor</I
|
|
></A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>. </B
|
|
> (dot)
|
|
<A
|
|
HREF="x17129.html#REGEXDOT"
|
|
>Match single
|
|
character</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>* </B
|
|
> (asterisk)
|
|
<A
|
|
HREF="special-chars.html#ASTERISKREF2"
|
|
>Any number of
|
|
characters</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>[ ]</B
|
|
> (brackets) <A
|
|
HREF="x17129.html#BRACKETSREF"
|
|
>Enclose character set
|
|
to match</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>\ </B
|
|
> (backslash) <A
|
|
HREF="x17129.html#REGEXBS"
|
|
>Escape</A
|
|
>, interpret following
|
|
character literally</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>\< ... \> </B
|
|
>
|
|
(angle brackets, <I
|
|
CLASS="FIRSTTERM"
|
|
>escaped</I
|
|
>)
|
|
<A
|
|
HREF="x17129.html#ANGLEBRAC"
|
|
>Word boundary</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17129.html#EXTREGEX"
|
|
>Extended</A
|
|
>
|
|
REs</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>+ </B
|
|
>
|
|
<A
|
|
HREF="x17129.html#PLUSREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Character
|
|
match</I
|
|
></A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>\{ \} </B
|
|
> <A
|
|
HREF="x17129.html#ESCPCB"
|
|
>Escaped
|
|
<SPAN
|
|
CLASS="QUOTE"
|
|
>"curly"</SPAN
|
|
> brackets</A
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>[: :] </B
|
|
> <A
|
|
HREF="x17129.html#POSIXREF"
|
|
>POSIX character classes</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#REPLYREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$REPLY</TT
|
|
></A
|
|
>,
|
|
Default value associated with <A
|
|
HREF="internal.html#READREF"
|
|
>read</A
|
|
>
|
|
command</P
|
|
><P
|
|
><A
|
|
HREF="restricted-sh.html#RESTRICTEDSHREF"
|
|
>Restricted shell</A
|
|
>,
|
|
shell (or script) with certain commands disabled</P
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#RETURNREF"
|
|
>return</A
|
|
>,
|
|
command that terminates a <A
|
|
HREF="functions.html#FUNCTIONREF"
|
|
>function</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#RUNPARTSREF"
|
|
>run-parts</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#RUNPARTSREF2"
|
|
>Running scripts
|
|
in sequence</A
|
|
>, without user intervention</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="subshells.html#SCOPEREF"
|
|
>Scope</A
|
|
> of a variable,
|
|
definition</P
|
|
><P
|
|
><A
|
|
HREF="options.html#INVOCATIONOPTIONSREF"
|
|
>Script options</A
|
|
>,
|
|
set at command line</P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#LIBROUTINES"
|
|
>Scripting routines</A
|
|
>,
|
|
library of useful definitions and <A
|
|
HREF="functions.html#FUNCTIONREF"
|
|
>functions</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#SECPROMPTREF"
|
|
>Secondary prompt</A
|
|
>,
|
|
<B
|
|
CLASS="COMMAND"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$PS2</TT
|
|
></B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="securityissues.html"
|
|
>Security issues</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="system.html#NMAPREF"
|
|
>nmap</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>network mapper</I
|
|
>
|
|
/ port scanner</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="system.html#SUDOREF"
|
|
>sudo</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#SUIDSCR"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>suid</I
|
|
>
|
|
commands inside a script</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="securityissues.html#INFECTEDSCRIPTS1"
|
|
>Viruses,
|
|
trojans, and worms</A
|
|
> in scripts</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="securityissues.html#SECURITYTIPS1"
|
|
>Writing
|
|
secure scripts</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="sedawk.html#SEDREF"
|
|
>sed</A
|
|
>,
|
|
pattern-based programming language
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x23170.html#SEDBASICTABLE"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>Table</B
|
|
></A
|
|
>,
|
|
basic operators</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x23170.html#SEDOPTABLE"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>Table</B
|
|
></A
|
|
>,
|
|
examples of operators</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="testbranch.html#SELECTREF"
|
|
>select</A
|
|
>,
|
|
construct for menu building
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="testbranch.html#INLISTOMIT"
|
|
><TT
|
|
CLASS="USERINPUT"
|
|
><B
|
|
>in
|
|
<TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>list</I
|
|
></TT
|
|
></B
|
|
></TT
|
|
> omitted</A
|
|
>
|
|
</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="system.html#SEMAPHOREREF"
|
|
>Semaphore</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#NEEDSEMICOLON"
|
|
>Semicolon required</A
|
|
>,
|
|
when <A
|
|
HREF="loops1.html#DOINREF"
|
|
>do</A
|
|
>
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>keyword</I
|
|
> is on first line of <A
|
|
HREF="loops1.html#FORLOOPREF1"
|
|
>loop</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#OMITSEMICOLON"
|
|
>When
|
|
terminating <I
|
|
CLASS="FIRSTTERM"
|
|
>curly-bracketed</I
|
|
>
|
|
code block</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#SEQREF"
|
|
>seq</A
|
|
>,
|
|
Emit a sequence of integers. Equivalent to <A
|
|
HREF="extmisc.html#JOTREF"
|
|
>jot</A
|
|
>.</P
|
|
><P
|
|
><A
|
|
HREF="internal.html#SETREF"
|
|
>set</A
|
|
>,
|
|
Change value of internal script variables
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="debugging.html#UNDVARERR"
|
|
>set -u</A
|
|
>,
|
|
Abort script with error message if attempting to use
|
|
an <I
|
|
CLASS="FIRSTTERM"
|
|
>undeclared</I
|
|
> variable.</P
|
|
></LI
|
|
></UL
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="part1.html#WHATSASCRIPT"
|
|
>Shell script</A
|
|
>,
|
|
definition of</P
|
|
><P
|
|
><A
|
|
HREF="wrapper.html#SHWRAPPER"
|
|
>Shell wrapper</A
|
|
>,
|
|
script embedding a command or utility</P
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#SHIFTREF"
|
|
>shift</A
|
|
>, reassigning
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>positional parameters</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#SHLVLREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$SHLVL</TT
|
|
></A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>shell level</I
|
|
>, depth to which the shell
|
|
(or script) is nested</P
|
|
><P
|
|
><A
|
|
HREF="internal.html#SHOPTREF"
|
|
>shopt</A
|
|
>,
|
|
change <I
|
|
CLASS="FIRSTTERM"
|
|
>shell options</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="debugging.html#SIGNALD"
|
|
>Signal</A
|
|
>,
|
|
a message sent to a process</P
|
|
><P
|
|
>Simulations
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="randomvar.html#BROWNIANREF"
|
|
>Brownian
|
|
motion</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="randomvar.html#BROWNIANREF"
|
|
>Galton
|
|
board</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="colorizing.html#HORSERACEREF"
|
|
>Horserace</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#LIFEREF"
|
|
><EM
|
|
>Life</EM
|
|
></A
|
|
>,
|
|
game of</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="mathc.html#CANNONREF"
|
|
>PI</A
|
|
>,
|
|
approximating by firing cannonballs</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#STACKEX0"
|
|
>Pushdown
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>stack</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="varsubn.html#SNGLQUO"
|
|
>Single quotes</A
|
|
>
|
|
(<B
|
|
CLASS="COMMAND"
|
|
>' ... '</B
|
|
>) <I
|
|
CLASS="FIRSTTERM"
|
|
>strong</I
|
|
> <A
|
|
HREF="quoting.html#QUOTINGREF"
|
|
>quoting</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="devref1.html#SOCKETREF"
|
|
>Socket</A
|
|
>, a communication
|
|
node associated with an I/O port</P
|
|
><P
|
|
>Sorting
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#BUBBLESORT"
|
|
>Bubble
|
|
sort</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#INSERTIONSORT0"
|
|
>Insertion
|
|
sort</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internal.html#SOURCEREF"
|
|
>source</A
|
|
>,
|
|
execute a script or, within a script, import a file
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#SOURCEPARAMS"
|
|
>Passing positional
|
|
parameters</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Spam</I
|
|
>, dealing with
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="communications.html#SPAMLOOKUP_0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Example
|
|
script</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="communications.html#ISSPAMMER_0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Example
|
|
script</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#ISSPAMMER2_0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Example
|
|
script</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#WHX0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Example
|
|
script</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#SCHARLIST1"
|
|
>Special characters</A
|
|
></P
|
|
><P
|
|
>Stack
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#STACKDEFREF"
|
|
>Definition</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Emulating a <I
|
|
CLASS="FIRSTTERM"
|
|
>push-down stack</I
|
|
>,
|
|
<A
|
|
HREF="arrays.html#STACKEX0"
|
|
>example script</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>Standard Deviation, <A
|
|
HREF="contributed-scripts.html#STDDEV"
|
|
>example script</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="files.html#FILESREF1"
|
|
>Startup files</A
|
|
>, Bash</P
|
|
><P
|
|
><A
|
|
HREF="ioredirintro.html#STDINOUTDEF"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>stdin</TT
|
|
>
|
|
and <TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#STOPWATCH"
|
|
>Stopwatch</A
|
|
>,
|
|
example script</P
|
|
><P
|
|
>Strings
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>=~ </B
|
|
>
|
|
<A
|
|
HREF="bashver3.html#REGEXMATCHREF"
|
|
>String match operator</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#SCOMPARISON1"
|
|
>Comparison</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PSOREX1"
|
|
>Length</A
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>${#string}</I
|
|
></TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#STRINGMANIP"
|
|
>Manipulation</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#AWKSTRINGMANIP2"
|
|
>Manipulation</A
|
|
>,
|
|
using <A
|
|
HREF="awk.html#AWKREF"
|
|
>awk</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#STRINGNOTNULL"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Null</I
|
|
>
|
|
string</A
|
|
>, testing for</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#PROTECTLITERAL0"
|
|
>Protecting strings</A
|
|
>
|
|
from expansion and/or reinterpretation,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>script example</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#UNPROTECTLITERAL0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Unprotecting</I
|
|
>
|
|
strings</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>script example</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>strchr()</I
|
|
>, <A
|
|
HREF="string-manipulation.html#SUBSTRINGINDEX2"
|
|
>equivalent of</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>strlen()</I
|
|
>, <A
|
|
HREF="string-manipulation.html#STRLEN"
|
|
>equivalent of</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#STRINGSREF"
|
|
>strings</A
|
|
> command,
|
|
find printable strings in a binary or data file</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Substring extraction</P
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#SUBSTREXTR01"
|
|
>${string:position}</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#SUBSTREXTR02"
|
|
>${string:position:length}</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#EXPEXTRSUB"
|
|
>Using
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>expr</I
|
|
></A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#SUBSTRINGINDEX2"
|
|
>Substring
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>index</I
|
|
></A
|
|
> (numerical position in
|
|
string)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#EXPRPAREN"
|
|
>Substring
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>matching</I
|
|
></A
|
|
>, using
|
|
<A
|
|
HREF="moreadv.html#EXPRREF"
|
|
>expr</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PSOREX1"
|
|
>Substring
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>removal</I
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PSOREXSH"
|
|
>${var#Pattern}</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PSOREXLO"
|
|
>${var##Pattern}</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PCTREP1"
|
|
>${var%Pattern}</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PCTREP2"
|
|
>${var%%Pattern}</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Substring replacement</P
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#SUBSTRREPL00"
|
|
>${string/substring/replacement}</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#SUBSTRREPL01"
|
|
>${string//substring/replacement}</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#SUBSTRREPL02"
|
|
>${string/#substring/replacement}</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="string-manipulation.html#SUBSTRREPL03"
|
|
>${string/%substring/replacement}</A
|
|
>
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#DAYSBETWEEN0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Script
|
|
example</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="refcards.html#STRINGOPSTAB"
|
|
><B
|
|
CLASS="COMMAND"
|
|
>Table</B
|
|
></A
|
|
>
|
|
of <I
|
|
CLASS="FIRSTTERM"
|
|
>string/substring</I
|
|
> manipulation and
|
|
extraction operators</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="varsubn.html#SNGLQUO"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Strong</I
|
|
> quoting</A
|
|
>
|
|
<B
|
|
CLASS="COMMAND"
|
|
>' ... '</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="scrstyle.html"
|
|
>Stylesheet</A
|
|
>
|
|
for writing scripts</P
|
|
><P
|
|
><A
|
|
HREF="subshells.html#SUBSHELLSREF"
|
|
>Subshell</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="subshells.html#SUBSHELLPARENS1"
|
|
>Command list within
|
|
parentheses</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="subshells.html#SUBSHNLEVREF"
|
|
>Variables</A
|
|
>,
|
|
<TT
|
|
CLASS="VARNAME"
|
|
>$BASH_SUBSHELL</TT
|
|
> and
|
|
<TT
|
|
CLASS="VARNAME"
|
|
>$SHLVL</TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Variables in a <I
|
|
CLASS="FIRSTTERM"
|
|
>subshell</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#VARSUBSH"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>scope</I
|
|
>
|
|
limited</A
|
|
>, but ...</P
|
|
><P
|
|
> ... <A
|
|
HREF="assortedtips.html#SUBSHTMP"
|
|
>can be accessed outside
|
|
the subshell?</A
|
|
>
|
|
</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="system.html#SUREF"
|
|
>su</A
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>Substitute
|
|
user</I
|
|
>, log on as a different user or as
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>root</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="fto.html#SUIDREF"
|
|
>suid</A
|
|
> (<I
|
|
CLASS="FIRSTTERM"
|
|
>set user
|
|
id</I
|
|
>) file flag
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#SUIDSCR"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>suid</I
|
|
>
|
|
commands inside a script</A
|
|
>, not advisable</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="basic.html#SYMLINKREF"
|
|
>Symbolic links</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="zeros.html#SWAPFILEREF"
|
|
>Swapfiles</A
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="tabexpansion.html"
|
|
>Tab completion</A
|
|
></P
|
|
><P
|
|
>Table lookup, <A
|
|
HREF="bashver2.html#RESISTOR"
|
|
>script
|
|
example</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="textproc.html#TAILREF"
|
|
>tail</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>echo</I
|
|
>
|
|
to <TT
|
|
CLASS="FILENAME"
|
|
>stdout</TT
|
|
> lines at the (tail) end of a text
|
|
file</P
|
|
><P
|
|
><A
|
|
HREF="filearchiv.html#TARREF"
|
|
>tar</A
|
|
>, archiving utility</P
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#TEEREF"
|
|
>tee</A
|
|
>, redirect to a file
|
|
output of command(s) partway through a <A
|
|
HREF="special-chars.html#PIPEREF"
|
|
>pipe</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="system.html#TERMINALSSYS1"
|
|
>Terminals</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="system.html#SETSERIALREF"
|
|
>setserial</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="system.html#SETTERMREF"
|
|
>setterm</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="system.html#STTYREF"
|
|
>stty</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="terminalccmds.html#TPUTREF"
|
|
>tput</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="system.html#WALLREF"
|
|
>wall</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>test</I
|
|
> command
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="testconstructs.html#TTESTREF"
|
|
>Bash
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>builtin</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="testconstructs.html#USRBINTEST"
|
|
>external
|
|
command</A
|
|
>, <TT
|
|
CLASS="FILENAME"
|
|
>/usr/bin/test</TT
|
|
>
|
|
(equivalent to <TT
|
|
CLASS="FILENAME"
|
|
>/usr/bin/[</TT
|
|
>)</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="testconstructs.html#TESTCONSTRUCTS1"
|
|
>Test constructs</A
|
|
></P
|
|
><P
|
|
>Test operators
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-a </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#COMPOUNDAND"
|
|
>Logical AND</A
|
|
>
|
|
compound comparison</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-e </B
|
|
>
|
|
<A
|
|
HREF="fto.html#RTIF"
|
|
>File exists</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-eq </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#EQUALREF"
|
|
>is-equal-to</A
|
|
> (integer
|
|
comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-f </B
|
|
>
|
|
<A
|
|
HREF="fto.html#REGULARFILE"
|
|
>File is a <I
|
|
CLASS="FIRSTTERM"
|
|
>regular</I
|
|
>
|
|
file</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-ge </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#GE0REF"
|
|
>greater-than or equal</A
|
|
>
|
|
(integer comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-gt </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#GT0REF"
|
|
>greater-than</A
|
|
> (integer
|
|
comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-le </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#LE0REF"
|
|
>less-than or equal</A
|
|
>
|
|
(integer comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-lt </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#LT0REF"
|
|
>less-than</A
|
|
>
|
|
(integer comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-n </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#STRINGNOTNULL"
|
|
>not-zero-length</A
|
|
>
|
|
(string comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-ne </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#NEQUALREF"
|
|
>not-equal-to</A
|
|
>
|
|
(integer comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-o </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#COMPOUNDOR"
|
|
>Logical OR</A
|
|
>
|
|
compound comparison</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-u </B
|
|
>
|
|
<A
|
|
HREF="fto.html#SUIDREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>suid</I
|
|
>
|
|
flag set</A
|
|
>, file test</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-z </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#STRINGNULL"
|
|
>is-zero-length</A
|
|
>
|
|
(string comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>= </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#SCOMPARISON1"
|
|
>is-equal-to</A
|
|
>
|
|
(string comparison)</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>== </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#SCOMPARISON2"
|
|
>is-equal-to</A
|
|
>
|
|
(string comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <B
|
|
CLASS="COMMAND"
|
|
>< </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#LTREF"
|
|
>less-than</A
|
|
>
|
|
(string comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>< </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#INTLT"
|
|
>less-than</A
|
|
>,
|
|
(integer comparison, within
|
|
<A
|
|
HREF="dblparens.html"
|
|
>double parentheses</A
|
|
>)
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
><= </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#LTEQ"
|
|
>less-than-or-equal</A
|
|
>,
|
|
(integer comparison, within
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>double parentheses</I
|
|
>)
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>> </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#GTREF"
|
|
>greater-than</A
|
|
>
|
|
(string comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>> </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#INTGT"
|
|
>greater-than</A
|
|
>,
|
|
(integer comparison, within
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>double parentheses</I
|
|
>)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>>= </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#GTEQ"
|
|
>greater-than-or-equal</A
|
|
>,
|
|
(integer comparison, within
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>double parentheses</I
|
|
>)
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>|| </B
|
|
>
|
|
<A
|
|
HREF="ops.html#ORREF"
|
|
>Logical OR </A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>&& </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#LOGICALAND"
|
|
>Logical AND</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>! </B
|
|
>
|
|
<A
|
|
HREF="special-chars.html#NOTREF"
|
|
>Negation operator</A
|
|
>, inverts <A
|
|
HREF="exit-status.html#EXITSTATUSREF"
|
|
>exit status</A
|
|
> of a
|
|
test</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>!= </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#NOTEQUAL"
|
|
>not-equal-to</A
|
|
>
|
|
(string comparison)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>Tables</B
|
|
> of <I
|
|
CLASS="FIRSTTERM"
|
|
>test</I
|
|
>
|
|
operators</P
|
|
><P
|
|
><A
|
|
HREF="refcards.html#BINCOMPTAB"
|
|
>Binary comparison</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="refcards.html#FILESTAB"
|
|
>File</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="textproc.html"
|
|
>Text and text file
|
|
processing</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="timedate.html"
|
|
>Time / Date</A
|
|
></P
|
|
><P
|
|
>Timed input
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#READTIMED"
|
|
>Using
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>read -t</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#STTYTO"
|
|
>Using
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>stty</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#TIMINGLOOP"
|
|
>Using
|
|
timing loop</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#TMOUTREF"
|
|
>Using
|
|
<TT
|
|
CLASS="VARNAME"
|
|
>$TMOUT</TT
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html"
|
|
>Tips and hints</A
|
|
>
|
|
for Bash scripts
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Array, <A
|
|
HREF="assortedtips.html#RETARRAY"
|
|
>as
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>return value</I
|
|
> from
|
|
a function</A
|
|
></P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Associative</I
|
|
> array
|
|
<A
|
|
HREF="optimizations.html#ASSOCARRTST"
|
|
>more efficient</A
|
|
>
|
|
than a numerically-indexed array</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="complexfunct.html#CAPTURERETVAL"
|
|
>Capturing
|
|
the return value</A
|
|
> of a function, using
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>echo</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="networkprogramming.html#CGISCRIPT"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>CGI</I
|
|
>
|
|
programming</A
|
|
>, using scripts for</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Comment blocks</P
|
|
><P
|
|
>Using <A
|
|
HREF="here-docs.html#CBLOCK1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>anonymous
|
|
here documents</I
|
|
></A
|
|
></P
|
|
><P
|
|
>Using <A
|
|
HREF="assortedtips.html#COMOUTBL"
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>if-then</I
|
|
>
|
|
constructs</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#COMMENTH"
|
|
>Comment headers</A
|
|
>,
|
|
special purpose</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#CSTYLE"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>C</I
|
|
>-style syntax </A
|
|
>,
|
|
for manipulating variables</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x23170.html#DOUBLESPACE"
|
|
>Double-spacing a text
|
|
file</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Filenames prefixed with a dash,
|
|
<A
|
|
HREF="basic.html#DASHREM"
|
|
>removing</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#FILTEROUTP"
|
|
>Filter</A
|
|
>,
|
|
feeding output back to <EM
|
|
>same</EM
|
|
>
|
|
filter</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Function<A
|
|
HREF="assortedtips.html#RVT"
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>return</I
|
|
> value
|
|
workarounds</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#IFGREPFIX"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>if-grep</I
|
|
>
|
|
test fixup</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#LIBROUTINES"
|
|
>Library</A
|
|
>
|
|
of useful definitions and
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>functions</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#NULLVAR"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>null</I
|
|
>
|
|
variable assignment</A
|
|
>, avoiding</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#PASSARRAY"
|
|
>Passing
|
|
an <I
|
|
CLASS="FIRSTTERM"
|
|
>array</I
|
|
></A
|
|
> to a
|
|
function</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$PATH</TT
|
|
>,
|
|
appending to, <A
|
|
HREF="bashver3.html#PATHAPPEND"
|
|
>using the
|
|
<TT
|
|
CLASS="VARNAME"
|
|
>+=</TT
|
|
> operator</A
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#PREPENDREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Prepending</I
|
|
></A
|
|
>
|
|
lines at head of a file</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#PROGRESSBAR"
|
|
>Progress
|
|
bar</A
|
|
> template</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#PSEUDOCODEREF"
|
|
>Pseudo-code</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#RCSREF"
|
|
>rcs</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#DEVNULLREDIRECT"
|
|
>Redirecting a <I
|
|
CLASS="FIRSTTERM"
|
|
>test</I
|
|
>
|
|
to <TT
|
|
CLASS="FILENAME"
|
|
>/dev/null</TT
|
|
></A
|
|
> to suppress output</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#RUNPARTSREF2"
|
|
>Running scripts in
|
|
sequence</A
|
|
> without user intervention, using <A
|
|
HREF="extmisc.html#RUNPARTSREF"
|
|
>run-parts</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Script<A
|
|
HREF="assortedtips.html#SCRIPTASEMB"
|
|
> as embedded
|
|
command</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Script <I
|
|
CLASS="FIRSTTERM"
|
|
>portability</I
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#SETPUM"
|
|
>Setting <I
|
|
CLASS="FIRSTTERM"
|
|
>path</I
|
|
>
|
|
and <I
|
|
CLASS="FIRSTTERM"
|
|
>umask</I
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#WHATISREF3"
|
|
>Using <I
|
|
CLASS="FIRSTTERM"
|
|
>whatis</I
|
|
></A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#SETVAREMB"
|
|
>Setting script variable</A
|
|
>
|
|
to a block of embedded <I
|
|
CLASS="FIRSTTERM"
|
|
>sed</I
|
|
> or
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>awk</I
|
|
> code</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Speeding up script execution by <A
|
|
HREF="optimizations.html#LCALL"
|
|
>disabling <I
|
|
CLASS="FIRSTTERM"
|
|
>unicode</I
|
|
></A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Subshell variable,
|
|
<A
|
|
HREF="assortedtips.html#SUBSHTMP"
|
|
>accessing outside the subshell</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#INTPARAM"
|
|
>Testing a variable</A
|
|
>
|
|
to see if it contains only digits</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#DEVNULLREDIRECT"
|
|
>Testing whether
|
|
a command exists</A
|
|
>, using <A
|
|
HREF="internal.html#TYPEREF"
|
|
>type</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#TRACKINGSCR"
|
|
>Tracking script
|
|
usage</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="process-sub.html#GOODREAD0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>while-read</I
|
|
> loop
|
|
without a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>subshell</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#WIDGETREF"
|
|
>Widgets</A
|
|
>, invoking from a
|
|
script</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#TMOUTREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$TMOUT</TT
|
|
></A
|
|
>,
|
|
Timeout interval</P
|
|
><P
|
|
><A
|
|
HREF="testconstructs.html#TOKENREF"
|
|
>Token</A
|
|
>, a symbol that may
|
|
expand to a <A
|
|
HREF="internal.html#KEYWORDREF"
|
|
>keyword</A
|
|
> or
|
|
command</P
|
|
><P
|
|
><A
|
|
HREF="terminalccmds.html#TPUTREF"
|
|
>tput</A
|
|
>, terminal-control
|
|
command</P
|
|
><P
|
|
><A
|
|
HREF="textproc.html#TRREF"
|
|
>tr</A
|
|
>, character translation filter
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="textproc.html#TRD2U"
|
|
>DOS to Unix text file
|
|
conversion</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="textproc.html#TROPTIONS"
|
|
>Options</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="contributed-scripts.html#SOUNDEX0"
|
|
>Soundex</A
|
|
>, <I
|
|
CLASS="FIRSTTERM"
|
|
>example
|
|
script</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="textproc.html#TRVARIANTS"
|
|
>Variants</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="debugging.html#TRAPREF1"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Trap</I
|
|
></A
|
|
>,
|
|
specifying an action upon receipt of a <A
|
|
HREF="debugging.html#SIGNALD"
|
|
>signal</A
|
|
></P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Trinary (ternary)</I
|
|
> operator,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>C</I
|
|
>-style,
|
|
<TT
|
|
CLASS="USERINPUT"
|
|
><B
|
|
>var>10?88:99</B
|
|
></TT
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#CSTRINARY"
|
|
>in
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>double-parentheses</I
|
|
>
|
|
construct</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#EX46"
|
|
>in <I
|
|
CLASS="FIRSTTERM"
|
|
>let</I
|
|
>
|
|
construct</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="internal.html#TRUEREF"
|
|
>true</A
|
|
>,
|
|
returns <I
|
|
CLASS="FIRSTTERM"
|
|
>successful</I
|
|
> (0) <A
|
|
HREF="exit-status.html#EXITSTATUSREF"
|
|
>exit status</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="declareref.html#DECLARE1REF"
|
|
>typeset</A
|
|
> builtin
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="declareref.html#DECLAREOPSREF1"
|
|
>options</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#UIDREF"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$UID</TT
|
|
></A
|
|
>,
|
|
User ID number</P
|
|
><P
|
|
><A
|
|
HREF="aliases.html#UNALIASREF"
|
|
>unalias</A
|
|
>,
|
|
to remove an <A
|
|
HREF="aliases.html#ALIASREF"
|
|
>alias</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="system.html#UNAMEREF"
|
|
>uname</A
|
|
>,
|
|
output system information</P
|
|
><P
|
|
><A
|
|
HREF="bashver4.html#UNICODEREF"
|
|
>Unicode</A
|
|
>, encoding standard
|
|
for representing letters and symbols
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="optimizations.html#LCALL"
|
|
>Disabling <I
|
|
CLASS="FIRSTTERM"
|
|
>unicode</I
|
|
></A
|
|
>
|
|
to optimize script</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#UNINITVAR"
|
|
>Uninitialized variables</A
|
|
> </P
|
|
><P
|
|
><A
|
|
HREF="textproc.html#UNIQREF"
|
|
>uniq</A
|
|
>,
|
|
filter to remove duplicate lines from a sorted file</P
|
|
><P
|
|
><A
|
|
HREF="internal.html#UNSETREF"
|
|
>unset</A
|
|
>,
|
|
delete a shell variable</P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#UNTILLOOPREF"
|
|
>until</A
|
|
> loop</P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>until [ condition-is-true ]; do</I
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Variables</I
|
|
>
|
|
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="arrays.html#ARRAYOPSVARS"
|
|
>Array operations on
|
|
</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="ops.html#ASNOP1"
|
|
>Assignment</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="varassignment.html#EX15_0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Script
|
|
example</I
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="varassignment.html#EX16_0"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Script
|
|
example</I
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="varsubn.html#VARUNSETTING"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Script
|
|
example</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Bash</I
|
|
>
|
|
internal variables</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#SETVAREMB"
|
|
>Block of <I
|
|
CLASS="FIRSTTERM"
|
|
>sed</I
|
|
> or
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>awk</I
|
|
> code</A
|
|
>, setting a variable
|
|
to</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>C-style</I
|
|
>
|
|
<A
|
|
HREF="dblparens.html#PLUSPLUSREF"
|
|
> increment/decrement/trinary operations</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> <A
|
|
HREF="internal.html#SETREF"
|
|
>Change value of internal script variables</A
|
|
>
|
|
using <I
|
|
CLASS="FIRSTTERM"
|
|
>set</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="declareref.html#DECLARE1REF"
|
|
>declare</A
|
|
>,
|
|
to modify the properties of variables</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#UNSETREF"
|
|
>Deleting a shell variable</A
|
|
>
|
|
using <I
|
|
CLASS="FIRSTTERM"
|
|
>unset</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#ENVREF"
|
|
>Environmental</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#EXPREPL1"
|
|
>Expansion / Substring
|
|
replacement</A
|
|
> operators</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="ivr.html#IVRREF"
|
|
>Indirect
|
|
referencing</A
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>eval variable1=\$$variable2</I
|
|
></TT
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="ivr.html#IVR2"
|
|
>Newer notation</A
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>${!variable}</I
|
|
></TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="ops.html#INTVARREF"
|
|
>Integer</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="untyped.html#BVUNTYPED"
|
|
>Integer / string</A
|
|
> (variables are
|
|
untyped)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PSOREX1"
|
|
>Length</A
|
|
></P
|
|
><P
|
|
><TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>${#var}</I
|
|
></TT
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="varsubn.html#LVALUEREF"
|
|
>Lvalue</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="parameter-substitution.html#PSSUB1"
|
|
>Manipulating and
|
|
expanding</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="varsubn.html#VARNAMEVAL"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Name</I
|
|
>
|
|
and <I
|
|
CLASS="FIRSTTERM"
|
|
>value</I
|
|
> of a variable</A
|
|
>,
|
|
distinguishing between</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="comparison-ops.html#STRINGNOTNULL"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Null</I
|
|
>
|
|
string</A
|
|
>, testing for</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="othertypesv.html#NULLVAR"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Null</I
|
|
>
|
|
variable assignment</A
|
|
>, avoiding</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="quotingvar.html"
|
|
>Quoting</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#FAILQUOTE"
|
|
>within <I
|
|
CLASS="FIRSTTERM"
|
|
>test</I
|
|
>
|
|
brackets</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="quotingvar.html#WSQUO"
|
|
>to preserve
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>whitespace</I
|
|
></A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="varsubn.html#LVALUEREF"
|
|
>rvalue</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="varsubn.html#VARUNSETTING"
|
|
>Setting to <I
|
|
CLASS="FIRSTTERM"
|
|
>null</I
|
|
>
|
|
value</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="subshells.html#PARVIS"
|
|
>In
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>subshell</I
|
|
></A
|
|
>
|
|
not visible to parent shell</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Testing a variable <A
|
|
HREF="assortedtips.html#INTPARAM"
|
|
> if it contains only digits</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="declareref.html#TYPINGREF"
|
|
>Typing</A
|
|
>,
|
|
restricting the properties of a variable</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="debugging.html#UNDVARERR"
|
|
>Undeclared</A
|
|
>,
|
|
error message</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="varsubn.html#UNINITVAR1"
|
|
>Uninitialized</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="quotingvar.html#VARSPLITTING"
|
|
>Unquoted
|
|
variable</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>splitting</I
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internal.html#UNSETREF"
|
|
>Unsetting</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="untyped.html#BVUNTYPED"
|
|
>Untyped</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="x9644.html#WAITREF"
|
|
>wait</A
|
|
>,
|
|
suspend script execution
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x9644.html#WAITHANG"
|
|
>To remedy
|
|
script hang</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="varsubn.html#DBLQUO"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Weak</I
|
|
> quoting</A
|
|
>
|
|
<B
|
|
CLASS="COMMAND"
|
|
>" ... "</B
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHILELOOPREF"
|
|
>while</A
|
|
> loop</P
|
|
><P
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>while [ condition ]; do</I
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHLOOPC"
|
|
>C-style syntax</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHILEFUNC"
|
|
>Calling a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>function</I
|
|
> within
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>test</I
|
|
> brackets</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHMULTCOND"
|
|
>Multiple
|
|
conditions</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHILENOBRACKETS"
|
|
>Omitting
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>test</I
|
|
> brackets</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="loops1.html#WHILEREADREF2"
|
|
> <I
|
|
CLASS="FIRSTTERM"
|
|
>while read</I
|
|
></A
|
|
>
|
|
construct
|
|
</P
|
|
><P
|
|
><A
|
|
HREF="process-sub.html#GOODREAD0"
|
|
>Avoiding a
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>subshell</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#WHITESPACEREF"
|
|
>Whitespace</A
|
|
>,
|
|
spaces, tabs, and newline characters
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="internalvariables.html#IFSWS"
|
|
><TT
|
|
CLASS="VARNAME"
|
|
>$IFS</TT
|
|
> defaults
|
|
to</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="gotchas.html#WSBAD"
|
|
>Inappropriate use
|
|
of</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="here-docs.html#INDENTEDLS"
|
|
>Preceding closing
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>limit string</I
|
|
></A
|
|
> in a <I
|
|
CLASS="FIRSTTERM"
|
|
>here
|
|
document</I
|
|
>, error</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#WSBCOMM"
|
|
>Preceding script
|
|
comments</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="quotingvar.html#WSQUO"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Quoting</I
|
|
></A
|
|
>,
|
|
to preserve <I
|
|
CLASS="FIRSTTERM"
|
|
>whitespace</I
|
|
> within strings
|
|
or variables</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="x17129.html#WSPOSIX"
|
|
>[:space:]</A
|
|
>,
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>POSIX</I
|
|
> character class</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="system.html#WHOREF"
|
|
>who</A
|
|
>, information about logged on users
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="system.html#WREF"
|
|
>w</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="system.html#WHOAMIREF"
|
|
>whoami</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="system.html#LOGNAMEREF"
|
|
>logname</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="assortedtips.html#WIDGETREF"
|
|
>Widgets</A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="globbingref.html#WILDCARDDEF"
|
|
>Wild card</A
|
|
> characters
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#ASTERISKREF"
|
|
>Asterisk
|
|
*</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>In <A
|
|
HREF="loops1.html#LIGLOB"
|
|
> <TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>[list]</I
|
|
></TT
|
|
> constructs</A
|
|
>
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="special-chars.html#WILDCARDQU"
|
|
>Question mark
|
|
?</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="globbingref.html#WDOTFILEWC"
|
|
>Will not match
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>dot files</TT
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>Word splitting
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="quotingvar.html#WSPLITREF"
|
|
>Definition</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="commandsub.html#CSWS"
|
|
>Resulting from <I
|
|
CLASS="FIRSTTERM"
|
|
>command
|
|
substitution</I
|
|
></A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="wrapper.html#SHWRAPPER"
|
|
>Wrapper</A
|
|
>, shell</P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#XARGSREF"
|
|
>xargs</A
|
|
>,
|
|
Filter for grouping arguments
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#XARGSCURLYREF"
|
|
> Curly brackets</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#XARGSLIMARGS"
|
|
> Limiting arguments passed</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#XARGSLIMARGS"
|
|
>Options</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Processes arguments <A
|
|
HREF="moreadv.html#XARGSONEATATIME"
|
|
>one at a time</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="moreadv.html#XARGSWS"
|
|
> Whitespace</A
|
|
>, handling</P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#YESREF"
|
|
>yes</A
|
|
>
|
|
<P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="extmisc.html#YESEMU"
|
|
>Emulation</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
></P
|
|
><P
|
|
>* * *</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>-z </B
|
|
>
|
|
<A
|
|
HREF="comparison-ops.html#STRINGNULL"
|
|
>String is
|
|
<I
|
|
CLASS="FIRSTTERM"
|
|
>null</I
|
|
></A
|
|
></P
|
|
><P
|
|
><A
|
|
HREF="x9644.html#ZOMBIEREF"
|
|
><I
|
|
CLASS="FIRSTTERM"
|
|
>Zombie</I
|
|
></A
|
|
>,
|
|
a process that has terminated, but not yet been <A
|
|
HREF="x9644.html#KILLREF"
|
|
>killed</A
|
|
> by its
|
|
<A
|
|
HREF="internal.html#PARENTREF"
|
|
>parent</A
|
|
></P
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="asciitable.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
> </TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>ASCII Table</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
> </TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |