diff options
| author | John Ogness <john.ogness@linutronix.de> | 2018-03-02 11:10:28 +0100 |
|---|---|---|
| committer | John Ogness <john.ogness@linutronix.de> | 2018-03-02 11:10:28 +0100 |
| commit | 4e716abb4818b2c5fc4c216302830715e734b5a8 (patch) | |
| tree | 6cc628c8f0ffc804f261324ec9235d20e0305e14 | |
| parent | 60635cecd1cb80aaf8a80b339aa760e927661419 (diff) | |
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 <john.ogness@linutronix.de>
| -rw-r--r-- | linux-basics/sh-programming/pres_sh-programming_de.tex | 31 |
1 files changed, 31 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 37fbafb..2af143f 100644 --- a/linux-basics/sh-programming/pres_sh-programming_de.tex +++ b/linux-basics/sh-programming/pres_sh-programming_de.tex @@ -25,6 +25,37 @@ echo Hello World \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} #!/bin/sh |
