From 60635cecd1cb80aaf8a80b339aa760e927661419 Mon Sep 17 00:00:00 2001 From: John Ogness Date: Fri, 2 Mar 2018 11:08:29 +0100 Subject: basics: sh-programming: add "case" example A simple example demonstrating the syntax of "case". Signed-off-by: John Ogness --- .../sh-programming/pres_sh-programming_de.tex | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'linux-basics/sh-programming/pres_sh-programming_de.tex') 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 -- cgit v1.2.3