about summary refs log tree commit diff
path: root/doc/index.html
blob: e6943e63ecd94f9fd155f4539afc937e00730c17 (plain) (blame)
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>execline: a small scripting language</title>
    <meta name="Description" content="execline: a small scripting language" />
    <meta name="Keywords" content="execline script scripting language shell embedded chain loading bernstein chaining unix" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> execline </h1>

<h2> What is it? </h2>

<p>
 execline is a (non-interactive) scripting language, like <tt>sh</tt> -
but its syntax is quite different from a traditional shell syntax.
The <tt>execlineb</tt> program is meant to be used as an interpreter for a
text file; the other commands are essentially useful inside an
<tt>execlineb</tt> script.
</p>

<p>
 execline is as powerful as a shell: it features
<a href="loopwhilex.html">conditional loops</a>,
<a href="elgetopt.html">getopt-style option handling</a>,
<a href="elglob.html">filename globbing</a>, and more.
 Meanwhile, its syntax is far more logic and predictable than the
shell's syntax, and has no security issues.
</p>

<ul>
<li> <a href="grammar.html">The execline design and grammar</a></li>
<li> <a href="dieshdiedie.html">Why not just use <tt>/bin/sh</tt>?</a></li>
</ul>

<hr />

<h2> Installation </h2>

<h3> Requirements </h3>

<ul>
 <li> A POSIX-compliant system with a standard C development environment </li>
 <li> GNU make, version 3.81 or later. </li>
 <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version
2.10.0.2 or later. It's a build-time requirement. It's also a run-time
requirement if you link against the shared version of the skalibs
library. </li>
</ul>

<p>
 The following optional dependencies are also supported:
</p>

<ul>
 <li> If you're using <a href="https://www.musl-libc.org/">musl</a> and
want nsswitch-like functionality:
<a href="//skarnet.org/software/nsss/">nsss</a> version
0.1.0.0 or later (build-time and boot-time) </li>
</ul>

<h3> Licensing </h3>

<p>
 execline is free software. It is available under the
<a href="https://opensource.org/licenses/ISC">ISC license</a>.
</p>

<h3> Download </h3>

<ul>
 <li> The current released version of execline is <a href="execline-2.8.0.0.tar.gz">2.8.0.0</a>. </li>
 <li> Alternatively, you can checkout a copy of the
<a href="//git.skarnet.org/cgi-bin/cgit.cgi/execline/">execline
git repository</a>:
<pre> git clone git://git.skarnet.org/execline </pre> </li>
 <li> There's also a
<a href="https://github.com/skarnet/execline">GitHub mirror</a>
of the execline git repository. </li>
</ul>

<h3> Compilation </h3>

<ul>
 <li> See the enclosed INSTALL file for installation details. </li>
</ul>

<h3> Upgrade notes </h3>

<ul>
 <li> <a href="upgrade.html">This page</a> lists the differences to be aware of between
the previous versions of execline and the current one. </li>
</ul>

<hr />

<h2> Special note </h2>

<p>
 Before version 2.0.0.0, execline used the slashpackage convention by default.
 This is not the case anymore; nevertheless, the examples in this documentation
still use <tt>#!/command/execlineb</tt> as their shebang line, and assume that
the execline binaries are available in <tt>/command</tt>. Adapt them according
to your installation: the shebang lines for your system might be something like
<tt>#!/bin/execlineb</tt>, or <tt>#!/usr/bin/execlineb</tt>, or
<tt>#!/usr/local/bin/execlineb</tt>, or something else entirely.
</p>

<hr />

<h2> Reference </h2>
<h3> Commands </h3>

<p>
 All these commands exit 111 if they encounter a temporary error, and
100 if they encounter a permanent error - such as a misuse. They exit
127 if they're trying to execute into a program and cannot find it, and
126 if they fail to execute into a program for another reason.
</p>

<p>
 (Script parser / launcher)
</p>
<ul>
<li><a href="execlineb.html">The <tt>execlineb</tt> program</a></li>
</ul>
<p>
 (Process state control)
</p>
<ul>
<li><a href="execline-cd.html">The <tt>execline-cd</tt> program</a></li>
<li><a href="posix-cd.html">The <tt>posix-cd</tt> program</a></li>
<li><a href="execline-umask.html">The <tt>execline-umask</tt> program</a></li>
<li><a href="posix-umask.html">The <tt>posix-umask</tt> program</a></li>
<li><a href="emptyenv.html">The <tt>emptyenv</tt> program</a></li>
<li><a href="envfile.html">The <tt>envfile</tt> program</a></li>
<li><a href="export.html">The <tt>export</tt> program</a></li>
<li><a href="unexport.html">The <tt>unexport</tt> program</a></li>
<li><a href="fdclose.html">The <tt>fdclose</tt> program</a></li>
<li><a href="fdblock.html">The <tt>fdblock</tt> program</a></li>
<li><a href="fdmove.html">The <tt>fdmove</tt> program</a></li>
<li><a href="fdswap.html">The <tt>fdswap</tt> program</a></li>
<li><a href="fdreserve.html">The <tt>fdreserve</tt> program</a></li>
<li><a href="redirfd.html">The <tt>redirfd</tt> program</a></li>
<li><a href="piperw.html">The <tt>piperw</tt> program</a></li>
<li><a href="heredoc.html">The <tt>heredoc</tt> program</a></li>
<li><a href="wait.html">The <tt>wait</tt> program</a></li>
<li><a href="getcwd.html">The <tt>getcwd</tt> program</a></li>
<li><a href="getpid.html">The <tt>getpid</tt> program</a></li>
<li><a href="exec.html">The <tt>exec</tt> program</a></li>
<li><a href="tryexec.html">The <tt>tryexec</tt> program</a></li>
<li><a href="exit.html">The <tt>exit</tt> program</a></li>
<li><a href="trap.html">The <tt>trap</tt> program</a></li>
<li><a href="withstdinas.html">The <tt>withstdinas</tt> program</a></li>
</ul>
<p>
 (<a href="el_semicolon.html">Basic block management</a>)
</p>
<ul>
<li><a href="foreground.html">The <tt>foreground</tt> program</a></li>
<li><a href="background.html">The <tt>background</tt> program</a></li>
<li><a href="if.html">The <tt>if</tt> program</a></li>
<li><a href="ifelse.html">The <tt>ifelse</tt> program</a></li>
<li><a href="ifte.html">The <tt>ifte</tt> program</a></li>
<li><a href="ifthenelse.html">The <tt>ifthenelse</tt> program</a></li>
<li><a href="backtick.html">The <tt>backtick</tt> program</a></li>
<li><a href="pipeline.html">The <tt>pipeline</tt> program</a></li>
<li><a href="runblock.html">The <tt>runblock</tt> program</a></li>
</ul>
<p>
 (<a href="el_substitute.html">Variable management</a>)
</p>
<ul>
<li><a href="define.html">The <tt>define</tt> program</a></li>
<li><a href="importas.html">The <tt>importas</tt> program</a></li>
<li><a href="elglob.html">The <tt>elglob</tt> program</a></li>
<li><a href="elgetpositionals.html">The <tt>elgetpositionals</tt> program</a></li>
<li><a href="multidefine.html">The <tt>multidefine</tt> program</a></li>
<li><a href="multisubstitute.html">The <tt>multisubstitute</tt> program</a></li>
</ul>
<p>
 (Loops)
</p>
<ul>
<li><a href="forx.html">The <tt>forx</tt> program</a></li>
<li><a href="forstdin.html">The <tt>forstdin</tt> program</a></li>
<li><a href="forbacktickx.html">The <tt>forbacktickx</tt> program</a></li>
<li><a href="loopwhilex.html">The <tt>loopwhilex</tt> program</a></li>
</ul>
<p>
 (Positional parameters and options management)
</p>
<ul>
<li><a href="elgetopt.html">The <tt>elgetopt</tt> program</a></li>
<li><a href="shift.html">The <tt>shift</tt> program</a></li>
<li><a href="dollarat.html">The <tt>dollarat</tt> program</a></li>
</ul>
<p>
 (Miscellaneous)
</p>
<ul>
<li><a href="homeof.html">The <tt>homeof</tt> program</a></li>
</ul>

<h3> Provided scripts: example <tt>.profile</tt> replacement </h3>

<ul>
<li><a href="execline-shell.html">The <tt>execline-shell</tt> script</a></li>
<li><a href="execline-startup.html">The <tt>execline-startup</tt> script</a></li>
</ul>

<h3> Fun stuff </h3>

<ul>
<li>An execline <a href="quine-jriou.txt">quine</a>. This was quinely provided by
<a href="http://jriou.org/">Jo&euml;l Riou</a>. The only
external command used is <tt>echo</tt>. </li>
<li> Another <a href="quine-prj.txt">quine</a>, provided by
<a href="https://code.dogmap.org/">Paul Jarc</a>. It is much shorter, but
uses the external commands <tt>echo</tt> and <tt>env</tt>. Later, Paul rewrote
it <a href="quine-prj-2.txt">using only <tt>echo</tt></a>, then
<a href="quine-prj-3.txt">using only <tt>echo</tt> and the environment</a>. </li>
<li> Another <a href="quine-dam.txt">quine</a>, provided by
<a href="http://www.madore.org/~david/">David Madore</a>. It uses the
external command <tt>printf</tt>. It is longer, but quite stylish. </li>
</ul>

<h2> Related resources </h2>

<h3> execline manual pages </h3>

<ul>
 <li> <a href="https://github.com/flexibeast">flexibeast</a> is providing
the execline documentation as a
<a href="https://github.com/flexibeast/execline-man-pages">set of man pages</a>. </li>
</ul>

<h3> execline discussion </h3>

<ul>
 <li> <tt>execline</tt> is discussed on the
<a href="//skarnet.org/lists.html#skaware">skaware</a> mailing-list. </li>
</ul>

</body>
</html>