annotate src/learn_bash.html.luan @ 45:14518d772090

start learn_bash
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 05 Jan 2024 01:34:32 -0700
parents src/learn.html.luan@5b4d5cf453a8
children 89fdc29b296f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 local pairs = Luan.pairs or error()
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local Io = require "luan:Io.luan"
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local Http = require "luan:http/Http.luan"
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local Shared = require "site:/lib/Shared.luan"
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 local head = Shared.head or error()
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 local header = Shared.header or error()
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 local content = {
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 intro = {
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
13 title = [[Introduction]]
40
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 content = function()
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 %>
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
16 <p>I really don't want to write this tutorial, but all the existing Bash tutorials are so horrible that I have no choice. I looked at books, websites, and YouTube - all horrible. They don't start with the basics. They include all kinds of useless crap. And they don't explain core concepts. So I have no choice but to write this damn thing.</p>
40
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
18 <p>I will focus on Mac and Windows. I don't have Linux, and I hate Linux, so I won't discuss it. Most of Bash is the same on Mac and Windows, but where they differ, I will discuss both.</p>
40
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 <%
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 end
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 }
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
22 access = {
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
23 title = [[Running Bash]]
40
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 content = function()
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 %>
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
26 <p>How you access Bash depends on your operating system. If you are on a Mac then you access Bash through the Mac Terminal which is found in "Applications > Utilities > Terminal.app". Be sure to <a href="https://www.howtogeek.com/444596/how-to-change-the-default-shell-to-bash-in-macos-catalina/">set the default shell to Bash</a>. If you are on Windows then install <a href="https://www.msys2.org/">MSYS2</a>. The default terminal isn't so good, so I suggest <a href="https://www.msys2.org/docs/terminals/#windows-terminal">using the Windows Terminal</a>.</p>
40
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 <%
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 end
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 }
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
30 start = {
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
31 title = [[Getting Started]]
41
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
32 content = function()
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
33 %>
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
34 <p>When I start Bash on my Mac I see:</p>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
35
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
36 <code block>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
37 Last login: Thu Jan 4 23:25:35 on ttys004
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
38
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
39 The default interactive shell is now zsh.
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
40 To update your account to use zsh, please run `chsh -s /bin/zsh`.
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
41 For more details, please visit https://support.apple.com/kb/HT208050.
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
42 ~ $
44
5b4d5cf453a8 start bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 43
diff changeset
43
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
44 </code>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
46 <p>On Windows - MSYS2 I just see:</p>
44
5b4d5cf453a8 start bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 43
diff changeset
47
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
48 <code block>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
49 ~ $
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
50
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
51 </code>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
52
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
53 <p>The line with the <b><code>$</code></b> is the command prompt. The cursor is at the end of it, and if I type, my text will go there. You may have different text before the <b><code>$</code></b> which is okay, but the line should end with <b><code>$</code></b>. If it doesn't, something is wrong.</p>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
54
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
55 <p>Now type "qqq". When I say type "whatever", you should type return/enter at the end. Only when you type return/enter will Bash process what you typed. Now you should see:</p>
44
5b4d5cf453a8 start bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 43
diff changeset
56
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
57 <code block>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
58 ~ $ qqq
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
59 -bash: qqq: command not found
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
60 ~ $
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
61 </code>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
62
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
63 <p>Bash doesn't know what "qqq" means and says so. Now try the following... Note that you type what is after the <b><code>$</code></b> and Bash should respond as shown.</p>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
64
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
65 <code block>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
66 ~ $ echo hi
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
67 hi
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
68 ~ $ echo how are you
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
69 how are you
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
70 ~ $ echo bye
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
71 bye
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
72 </code>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
73
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
74 <p>The <code>echo</code> command just echos what comes after. Now press the up-arrow on your keyboard. This should put the previous command where your cursor is. Up-arrow again brings the command before that. Try down-arrow and left-arrow and right-arrow. You can use this to navigate through your command history. The delete key also works for editing lines. And of course you can type. When you press return/enter then Bash will get your edited command and process it.</p>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
75
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
76 <p>When you enter <code>echo how are you</code>, <code>echo</code> is the command. This command has 3 arguments: <code>how</code>, <code>are</code>, and <code>you</code>. Commands and arguments are separated with spaces. It doesn't matter how many spaces, so:</p>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
77
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
78 <code block>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
79 ~ $ echo how are you
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
80 how are you
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
81 </code>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
82
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
83 <p><code>echo</code> just returns the arguments separated by one space.</p>
41
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
84 <%
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
85 end
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
86 }
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
87 man = {
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
88 title = [[The "man" Command]]
41
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
89 content = function()
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
90 %>
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
91 <p>Enter:</p>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
92 <code block>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
93 ~ $ man echo
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
94 </code>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
95
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
96 <p>You should get:</p>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
97
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
98 <code block>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
99
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
100 ECHO(1) BSD General Commands Manual ECHO(1)
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
101
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
102 NAME
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
103 echo -- write arguments to the standard output
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
104
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
105 SYNOPSIS
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
106 echo [-n] [string ...]
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
107
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
108 DESCRIPTION
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
109 The echo utility writes any specified operands, separated by single blank
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
110 (` ') characters and followed by a newline (`\n') character, to the stan-
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
111 dard output.
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
112
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
113 The following option is available:
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
114
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
115 -n Do not print the trailing newline character. This may also be
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
116 achieved by appending `\c' to the end of the string, as is done by
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
117 iBCS2 compatible systems. Note that this option as well as the
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
118 effect of `\c' are implementation-defined in IEEE Std 1003.1-2001
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
119 (``POSIX.1'') as amended by Cor. 1-2002. Applications aiming for
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
120 maximum portability are strongly encouraged to use printf(1) to
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
121 suppress the newline character.
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
122 :
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
123 </code>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
124
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
125 <p>But if you are on Windows, you may not have <code>man</code> installed. In that case, do:</p>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
126
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
127 <code block>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
128 ~ $ pacman -S man-db
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
129 </code>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
130
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
131 <p>to install <code>man</code> as described <a href="https://packages.msys2.org/package/man-db">here</a> and then try <code>man echo</code> again.</p>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
132
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
133 <p>The <code>man</code> command shows documentation of commands. Unfortunately it has a silly user interface based on memorizing keys, so I will just tell you the few keys you need. Down-arrow and up-arrow move down and up by one line. The space key moves down by one page. And most importantly, typing "q" quits and takes you back to Bash. You just have to memorize this.</p>
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
134
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
135 <p>Now try entering <code>man man</code>. You don't need all the stuff shown, but you can see what a complicated man page looks like. You can use <code>man</code> to get the documentation of other commands as I discuss them.</p>
41
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
136 <%
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
137 end
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
138 }
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
139 later = {
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
140 title = [[placeholder]]
41
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
141 content = function()
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
142 %>
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
143 <p>later</p>
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
144 <%
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
145 end
fbf2a8deee98 learn minor
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
146 }
40
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
147 }
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
148
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
149
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
150 local function show_toc(content)
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
151 %>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
152 <ul>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
153 <%
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
154 for id, info in pairs(content) do
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
155 %>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
156 <li><a id="c_<%=id%>" href="#<%=id%>"><%=info.title%></a></li>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
157 <%
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
158 end
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
159 %>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
160 </ul>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
161 <%
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
162 end
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
163
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
164 local function show_content(content,h)
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
165 for id, info in pairs(content) do
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
166 %>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
167 <div heading>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
168 <h<%=h%>><a id="<%=id%>" href="#<%=id%>"><%=info.title%></a></h<%=h%>>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
169 <a href="#c_<%=id%>">contents</a>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
170 </div>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
171 <%
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
172 info.content()
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
173 end
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
174 end
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
175
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
176 return function()
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
177 Io.stdout = Http.response.text_writer()
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
178 %>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
179 <!doctype html>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
180 <html>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
181 <head>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
182 <% head() %>
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
183 <title>Reactionary Bash Tutorial</title>
40
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
184 </head>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
185 <body>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
186 <% header() %>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
187 <div content>
45
14518d772090 start learn_bash
Franklin Schmidt <fschmidt@gmail.com>
parents: 44
diff changeset
188 <h1><a href="learn.html">Reactionary Bash Tutorial</a></h1>
40
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
189 <hr>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
190 <h2>Contents</h2>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
191 <div toc>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
192 <% show_toc(content) %>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
193 </div>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
194 <hr>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
195 <% show_content(content,2) %>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
196 </div>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
197 </body>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
198 </html>
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
199 <%
ebab99118e19 add learn.html
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
200 end