-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpracticum.tex
146 lines (131 loc) · 5.13 KB
/
practicum.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
\PassOptionsToPackage{bookmarks={true}}{hyperref}
\pdfminorversion=4
\documentclass[mathserif,xcolor={dvipsnames,table}]{beamer}
\mode<presentation>{\usetheme{Warsaw}\usecolortheme{crane}}
\usepackage{centernot}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{transparent}
\usepackage{tikz}
\usetikzlibrary{shadows}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[babel=true]{microtype}
\usepackage{amsmath}
\beamertemplatenavigationsymbolsempty
\title{\textbf{Not Sucking in the UNIX Environment}}
\date{}
\author{CS4803UWS at the\\
Georgia Institute of Technology
}
\begin{document}
{
\setbeamertemplate{background canvas}{%
\includegraphics[width=\paperwidth,height=\paperheight]{images/gt2.jpeg}
}%
\begin{frame}[plain]
\textcolor{white}{
\transparent{0.5}%
\colorbox{black}{\textbf{not sucking in the unix environment}}
}
\vspace{2.7in}
\\
\hfill\includegraphics[scale=.25]{images/cc-logo.pdf}
\includegraphics[scale=.25]{images/cc-new.pdf}
\includegraphics[scale=.25]{images/cc-share.pdf}
\textcolor{white}{
\\
\hfill \tiny{CC3.0 share-alike attribution}\\
}
\textcolor{white}{
\hfill \scriptsize{copyright \copyright\ 2013}\\
}
\end{frame}
}
\begin{frame}
\huge{SCRIPTING}
\end{frame}
\begin{frame}{Bash grammar\footnote{\tiny{This does not conform to {\tt bash(1)} as of 4.2; I believe the official grammar to be inaccurate.}}}
\tiny{
\begin{description}
\item[\textbf{compound::=}] {\tt(}<list>{\tt)} | {\tt\{}<list>{\tt;\}} | {\tt((}<arithexpr>{\tt))} | {\tt[[}<condexpr>{\tt]]} |\\
{\tt for} <name> [{\tt in} <word> \ldots {\tt;}] {\tt do} <list> {\tt; done} |\\
{\tt for ((} <expr> {\tt;} <expr> {\tt;} <expr> {\tt)) ;} {\tt do} <list> {\tt; done} |\\
{\tt select} <name> [{\tt in} <word>] {\tt; do} <list> {\tt; done} |\\
{\tt case} <word> {\tt in} [[{\tt(}<pattern> [| <pattern>\ldots]{\tt)}] <list> {\tt;;}] \ldots {\tt esac} |\\
{\tt if} <list> {\tt; then} <list> {\tt;} [{\tt elif} <list> {\tt; then} <list> {\tt;}] \ldots [{\tt else} <list> {\tt;}] {\tt fi} |\\
{\tt while} <list> \textbf{FIXME} |\\
{\tt until} <list> \textbf{FIXME}
\item[\textbf{function::=}]\ <name> () <compound> [<redirection>] | \\
{\tt function} name [{\tt ()}] <compound> [<redirection>]
\item[\textbf{coproc::=}] {\tt coproc} <name>
\item[\textbf{list::=}]\ <pipeline> [{\tt;} | {\tt\&} | {\tt\&\&} | {\tt||} <pipeline> \ldots] [{\tt;} | {\tt\&}]
\item[\textbf{pipeline::=}] [{\tt time} [{\tt -p}]] [{\tt!}] <command> [{\tt|} | {\tt|\&} <command> \ldots]
\item[\textbf{arithexpr::=}]
\item[\textbf{condexpr::=}]
\item[\textbf{command::=}]
\end{description}
}
\end{frame}
\begin{frame}{Shell scripts}
\begin{itemize}
\item POSIX conformance: probably not worth it
\item First line: \texttt{\#!/bin/sh} or \texttt{/usr/bin/env} \textit{shell}
\item Second line: \texttt{set -e || exit 1}
\item Pipelines only fail if the last command fails\footnote{Unless \texttt{-o pipefail} (bash-only) is used.}
\item Catch subshell errors via assignment
\item \texttt{trap} on signals and pseudo-signal 0\footnote{bash allows \texttt{trap}ping EXIT as a synonym for 0.}
\end{itemize}
\end{frame}
\begin{frame}{Redirection}
\begin{itemize}
\item Pipe creation occurs prior to redirection
\item Redirect to stderr: \texttt{>\&2}
\item Functions can be redirected at definition, \textit{and} at invocation
\item Pipes can't target functions (use \texttt{read} if you must)
\item Redirect both stdout and stderr: \texttt{>} \textit{redir} \texttt{2>\&1}
\item Send stderr to stdin through pipe: \texttt{|\&} (\texttt{2>\&1 |})
\item Duplicate to stdout and a file: \texttt{| tee} \textit{file}
\item Append: \texttt{>}\texttt{>}\textit{file}
\item Dup and append: \texttt{| tee -a} \textit{file}
\item \texttt{/dev/std\{in, out, err\}}: stdio in a filename context
\end{itemize}
\end{frame}
\begin{frame}{Perl}
Please don't write perl.
\end{frame}
\begin{frame}{FIXME}
\huge FIXME approximately 5 more pages...
\end{frame}
\begin{frame}
\huge{C/C++}
\end{frame}
\begin{frame}{GNU Autotools in one terrible diagram}
\includegraphics[scale=0.45]{images/circleoflife.png}
\end{frame}
\begin{frame}{FIXME}
\huge FIXME approximately 10 more pages...
\end{frame}
\begin{frame}{Recommended reading}
\begin{itemize}
\small{
\item Dennis Ritchie. ``Evolution of the Unix Time-sharing System'' (1979).
\item Neil Brown. ``Ghosts of UNIX Past'' LWN, in four parts (2004).
\item Tom Christiansen. ``\texttt{csh} Programming Considered Harmful'' (1995).
\item Mendel Cooper. ``Advanced Bash-Scripting Guide'' (2012).
\item Peter Krumins. ``\texttt{sed} One-Liners Explained'' (2008).
\item Peter Krumins. ``\texttt{awk} One-Liners Explained'' (2008).
\item Steve Yegge. ``Ancient Languages: Perl'' (2004-12-04).
\item ``Implementing a Job Control Shell'' GNU libc Info pages.
\item Neal Stephenson. \textit{In the Beginning was the Command Line} (1999).
}
\end{itemize}
\end{frame}
\begin{frame}{Hack on!}
``One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs.''\hfill---Robert Firth
\vfill
``It's easier to port a shell than a shell script.''\hfill---Larry Wall
\end{frame}
\end{document}