Skip to content
Snippets Groups Projects
Commit f76775e6 authored by Thomas Junier's avatar Thomas Junier
Browse files

italics around nonliteral []*?

parent 5fef1a15
Branches
No related tags found
No related merge requests found
......@@ -5,11 +5,11 @@ geometry:
colorlinks: on
---
Preamble
Notation
========
Roman `[ ] *` stand for themselves; when in italics they denote one or
more _`[`_ optional elements _`]`_ (0 or 1) or indicate repetition (_`*`_).
Roman `[ ] *` stand for themselves; in italics they denote _`[`_ optional
elements _`]`_ (0 or 1) or indicate repetition (_`*`_) ($\geq 1$).
Operation
=========
......@@ -41,12 +41,12 @@ Parsing
The tokens are split into commands, of which there are the following four kinds:
* Simple commands: _`[`_`assignment`_`*]`_ `program` _`[`_`arg`_`*] [`_`&`_`]`_
* Pipelines: `cmd [| cmd]*` (or `|&` to redirect `stderr` too)
* Pipelines: `cmd` _`[`_`| cmd`_`]*`_ (or `|&` to redirect `stderr` too)
* Lists: $\geq 1$ pipelines; precedence: `&&`,`||`; `&`,`;`
* `ppln1 [&& ppln2]` 2 iff 1 succeeds
* `ppln1 [|| ppln2]` 2 iff 1 fails
* `ppln1 [; ppln2]` 2 waits for 1
* `ppln1 [& ppln2]` doesn't wait (bg)
* `ppln1` _`[`_`&& ppln2`_`]`_ 2 iff 1 succeeds
* `ppln1` _`[`_`|| ppln2`_`]`_ 2 iff 1 fails
* `ppln1` _`[`_`; ppln2`_`]`_ 2 waits for 1
* `ppln1` _`[`_`& ppln2`]] doesn't wait (bg)
* Compound commands:
* Loops
* Conditionals
......@@ -68,9 +68,39 @@ Expansions
## Brace Expansion
special `[]*`
A prefix and suffix (both possibly empty) are affixed to each
of a list of strings. This is either an explicit list, or a sequence.
1. Brace: `{X,Y[,Z]*}`; `{x..y[..step]}`
### `{,}` List
Generate lists of strings, normally with a common prefix, suffix, or both.
\begin{tabular}{p{2.5cm}p{3.5cm}p{4cm}}
\textbf{expansion} & \textbf{value} & \textbf{comment} \\
\texttt{pr\{A,B,C\}} & \texttt{prA prB prC} & prefix \\
\texttt{\{A,B,C\}su} & \texttt{Asu Bsu Csu} & suffix \\
\texttt{pr\{A,B,C\}su} & \texttt{prAsu prBsu prCsu} & both
\end{tabular}
### `{..}` Sequence
Generate sequences, possibly with a common prefix, suffix, or both. Specify
start, stop, and an optional step.
\begin{tabular}{p{2.0cm}p{4cm}p{4cm}}
\textbf{expansion} & \textbf{value} & \textbf{comment} \\
\texttt{\{1..5\}} & \texttt{1 2 3 4 5} & \\
\texttt{f\{1..4\}.c} & \texttt{f1.c f2.c f3.c f4.c} & affixes \\
\texttt{\{5..1\}} & \texttt{5 4 3 2 1} & reverse \\
\texttt{\{01..5\}} & \texttt{01 02 03 04 05} & fixed width \\
\texttt{\{1..10..2\}} & \texttt{1 3 5 7 9} & step \\
\texttt{\{a..e\}} & \texttt{a b c d e} & character
\end{tabular}
Nesting is possible: `{a,b,c{1..3}}` $\rightarrow$ ` a b c1 c2 c3`
**Note**: contrary to _filename expansion_, the generated strings do _not_ have to match
filenames.
Tilde Expansion
---------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment