-
Notifications
You must be signed in to change notification settings - Fork 0
/
presentation.tex
100 lines (88 loc) · 2.83 KB
/
presentation.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
\documentclass{beamer}
\usetheme[alternativetitlepage=true]{Torino}
\usepackage{listings}
\usepackage{hyperref}
\graphicspath{ {images/}}
\author{Scott Moser}
\title{Shell Script\^H\^H\^H\^H\^HProgramming Tips}
\institute{Michigan!/usr/group}
\date{June 9, 2014}
\begin{document}
\begin{frame}[t,plain]
\titlepage
\end{frame}
\begin{frame}
\frametitle{The Plan}
\begin{itemize}
\item Why Shell Programming?
\item From Script to Program?
\item Shell Script Tips
\item questions
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Replace You}
\includegraphics{replace-you}
\end{frame}
\begin{frame}
\frametitle{Shell Programming? What year is this!?}
\begin{itemize}
\item for I in perl python ruby python3; echo \$I replaced need for shell; done
\item shell is cryptic, \$I is beautiful.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Yes, Shell!}
\begin{itemize}
\item shell is *crazy fast* [scripts/bench-startup]
\item even \href{https://gist.github.com/smoser/9780744}{/bin/bash is fast}.
\item Ok, they're fast, but why do I care?
\begin{itemize}
\item your system load is 200, figure out why.
\item tab completion
\item boot time (hint, boot uses a lot of shell). 180 forks to init. 1059 to rc.local.
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Why Else?}
\begin{itemize}
\item copy and pasteable
\item /bin/sh actually *is* ubiquitus . openwrt, bsd, its just always there.
\item sometimes its the only thing available.
\item sometimes its actually the simplist thing.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Shell Scripting to Shell Programming}
\begin{itemize}
\item functions and return values
\item declare and initialize variables
\item Usage
\item set -f
\item \href{https://github.com/smoser/talk-shell-script/blob/master/scripts/newscript}{newscript}
\item getopt
\item \href{https://github.com/smoser/talk-shell-script/blob/master/scripts/negative-logic}{negative-logic}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Tips and tricks}
\begin{itemize}
\item Use "standard tools" (awk, sed, sh)
\item \href{https://github.com/smoser/talk-shell-script/blob/master/scripts/cleanup}{cleanup}
\item \$\{varname:+foo\} and \$\{varname:-foo\}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Why bash?}
\begin{itemize}
\item \href{https://github.com/smoser/talk-shell-script/blob/master/scripts/arrays}{real arrays}
\item \$\{HOME//e/ie\}
\item hashes
\item better trap
\item \href{https://github.com/smoser/talk-shell-script/blob/master/scripts/}{\$BASH\_PIPESTATUS}
\item \$RANDOM
\item \$SECONDS
\end{itemize}
\end{frame}
\end{document}