From 4e716abb4818b2c5fc4c216302830715e734b5a8 Mon Sep 17 00:00:00 2001 From: John Ogness Date: Fri, 2 Mar 2018 11:10:28 +0100 Subject: basics: sh-programming: more variable setting examples There are several methods of setting and printing variables. Add a couple frames to help clarify that before jumping into the more complex examples. Signed-off-by: John Ogness --- .../sh-programming/pres_sh-programming_de.tex | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/linux-basics/sh-programming/pres_sh-programming_de.tex b/linux-basics/sh-programming/pres_sh-programming_de.tex index 37fbafb..2af143f 100644 --- a/linux-basics/sh-programming/pres_sh-programming_de.tex +++ b/linux-basics/sh-programming/pres_sh-programming_de.tex @@ -24,6 +24,37 @@ echo Hello World \end{lstlisting} \end{frame} +\begin{frame}[fragile] +\frametitle{Variablen} +\begin{lstlisting} +#!/bin/sh + +# VAR1 defined for this process +VAR1=abc + +# now VAR1 is defined for children processes +export VAR1 + +# VAR2 defined only for /bin/sh child process +# (with export set) +VAR2=def /bin/sh +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{Variablen} +\begin{lstlisting} +#!/bin/sh + +VAR1=abc + +echo $VAR1 + +echo ${VAR1} + +\end{lstlisting} +\end{frame} + \begin{frame}[fragile] \frametitle{Variablen und Parameter} \begin{lstlisting} -- cgit v1.2.3