diff options
| author | John Ogness <john.ogness@linutronix.de> | 2018-03-02 11:08:29 +0100 |
|---|---|---|
| committer | John Ogness <john.ogness@linutronix.de> | 2018-03-02 11:08:29 +0100 |
| commit | 60635cecd1cb80aaf8a80b339aa760e927661419 (patch) | |
| tree | c4fc6c6235ba6e9280c4150c4968693354a64106 /linux-basics | |
| parent | a8dd99e2a4961fffcc4f865cfcc277ccdfd9fcf2 (diff) | |
basics: sh-programming: add "case" example
A simple example demonstrating the syntax of "case".
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Diffstat (limited to 'linux-basics')
| -rw-r--r-- | linux-basics/sh-programming/pres_sh-programming_de.tex | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/linux-basics/sh-programming/pres_sh-programming_de.tex b/linux-basics/sh-programming/pres_sh-programming_de.tex index c7d4849..37fbafb 100644 --- a/linux-basics/sh-programming/pres_sh-programming_de.tex +++ b/linux-basics/sh-programming/pres_sh-programming_de.tex @@ -134,6 +134,31 @@ exit 0 \begin{lstlisting} #!/bin/sh +VAR=abcdef + +case $VAR in +abc) + echo "exactly abc" + ;; +abcdef) + echo "exactly abcdef" + ;; +abc*) + echo "begins with abc" + ;; +*) + echo "match everything" + ;; +esac + +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{Bedingte Verzweigungen} +\begin{lstlisting} +#!/bin/sh + # Short circuit tests: make && make install |
