Lines Matching refs:tt

3 Title: How do you spell <tt>mksh</tt>? How do you pronounce it?
6 “<tt>mksh</tt>” (with, even at the beginning of a sentence, <a
22 <tt>COMMAND.COM</tt>, <tt>CMD.EXE</tt> or PowerShell on other operating
42 command <tt>PATH=.$PATHSEP$PATH</tt> or add that to a suitable
43 initialisation file (<tt>~/.mkshrc</tt>).</p>
49 <tt>-T</tt> is added during compilation; however, you will most likely
62 <p>There’s now <tt>ksh2020</tt>, a project having restarted development
63 around November 2017 forking the last <tt>ksh93 v-</tt> (beta) snapshot
100 <p>The <a href="@@RELPATH@@ksh-chan.htm">Homepage of the <tt>#ksh</tt>
107 <p>Export a few environment variables, namely <tt>CC</tt> (the C compiler),
108 <tt>CPPFLAGS</tt> (all C præprocessor definitions), <tt>CFLAGS</tt> (only
109 compiler flags, <em>no</em> <tt>-Dfoo</tt> or anything!), <tt>LDFLAGS</tt>
110 (for anything to pass to the C compiler while linking) and <tt>LIBS</tt>
112 wish to <tt>export LDSTATIC=-static</tt> for a static build as well.</p>
113 <p>When cross-compiling, <tt>CC</tt> is the <em>cross</em> compiler (mksh
115 you <em>must</em> also export <tt>TARGET_OS</tt> to whatever system you
117 the uname(1) output. Some very rare systems also need <tt>TARGET_OSREV</tt>;
118 consult the source code of <tt>Build.sh</tt> for details.</p>
119 <p>Create two subdirectories, say <tt>build-mksh</tt> and <tt>build-lksh</tt>.
120 In each of them, start a compilation by issuing <tt>sh ../Build.sh -r</tt>
122 <tt>./test.sh</tt>. For lksh(1) add <tt>-DMKSH_BINSHPOSIX</tt> to
123 <tt>CPPFLAGS</tt> and use <tt>sh ../Build.sh -r -L</tt> to compile.</p>
125 <p>Install <tt>build-mksh/mksh</tt> as <tt>/bin/mksh</tt> (or similar),
126 <tt>build-lksh/lksh</tt> as <tt>/bin/lksh</tt> with a symlink(7) to it
127 from <tt>/bin/sh</tt> (if desred), and <tt>mksh.1</tt> and <tt>lksh.1</tt>
128 as manpages (mdoc macropackage required). Install <tt>dot.mkshrc</tt>
129 either as <tt>/etc/skel/.mkshrc</tt> (meaning your users will have to
131 upgrade) or as <tt>/etc/mkshrc</tt>, in which case you install a <a
133 script like Debian’s</a> into <tt>/etc/skel/.mkshrc</tt>. You may need a <a
135 <p>At runtime, the presence of <tt>/bin/ed</tt> as default history editor
137 preformatted manpages from <tt>build-*ksh/*ksh.cat1</tt> if nroff(1) (or
138 <tt>$NROFF</tt>) is available at build time by removing the <tt>-r</tt>
139 flag from either <tt>Build.sh</tt> invocation.</p>
141 FIFOS (cf. mkfifo(2))/pipes at runtime. Set <tt>TMPDIR</tt> to a suitable
142 location if <tt>/tmp</tt> isn’t it; if this is known ahead of time, you
143 can add <tt>-DMKSH_DEFAULT_TMPDIR=\"/path/to/tmp\"</tt> to CPPFLAGS. We
147 <tt>/bin/ed</tt>, and perl(1) is needed. When cross-compiling, the version
148 of the first <tt>ed</tt> binary on the <tt>PATH</tt> <em>must</em> be the
157 <p>The shell loads first <tt>/etc/profile</tt> then <tt>~/.profile</tt>
158 if called as login shell or with the <tt>-l</tt> flag, then loads the file
159 <tt>$ENV</tt> points to (defaulting to <tt>~/.mkshrc</tt>) for interactive
161 <p>Distributors should take care to either install the <tt>dot.mkshrc</tt>
162 example provided into <tt>/etc/skel/.mkshrc</tt> (so that it’s available
165 as, for example, <tt>/etc/mkshrc</tt> and install a skeleton file, such
166 as the one in Debian, that sources the file in <tt>/etc</tt>.</p>
172 (like pam_mkhomedir), you can <tt>export ENV</tt> in <tt>/etc/profile</tt>
173 to a file (say <tt>/etc/shellrc</tt>) that sources the per-shell file.
174 Users can, this way, still override it by setting a different <tt>$ENV</tt>
175 in their <tt>~/.profile</tt>.</p>
182 just ran into one. If you’re using LTO (the <tt>Build.sh</tt> option
183 <tt>-c lto</tt>) try to disable it first — especially GCC is a repeat
184 offender breaking LTO and its antecessor <tt>-fwhole-program --combine</tt>
199 <p>You can, however, add the <tt>-M</tt> flag to your <tt>Build.sh</tt>
200 invocations to let it produce a <tt>Makefrag.inc</tt> file <em>tailored
216 <tt>/bin/ksh</tt> (which is a pdksh) with mksh. On at least NetBSD®
217 1.6 and up (not 1.5) and OpenBSD, even <tt>/bin/sh</tt> is fair game.</p>
242 “shellsnippets” repository referenced in the <tt>#ksh</tt> channel
252 <tt>/</tt> in less(1), to spot it quickly).
257 <p>There are several reasons why your <tt>PS1</tt> might be not
259 <li><tt>$PS1</tt> is <tt>export</tt>ed. <strong>Do not export PS1!</strong>
263 <li><tt>$ENV</tt> <a href="#env">is set and/or <tt>export</tt>ed</a>.</li>
264 <li>Your prompt is just “<tt># </tt>”: you’re entering a root shell, and
265 <tt>$PS1</tt> does not contain the ‘#’ character, in which case the shell
267 <li>Your prompt is just “<tt>$ </tt>”: perhaps your system administrator
268 did not install the shipped <tt>dot.mkshrc</tt> file, or you did not copy
269 <tt>/etc/skel/.mkshrc</tt> into your home directory (perhaps it was created
270 before <tt>mksh</tt> was installed?). Without another idea for a fix, get <a
272 file</a> and store it as <tt>~/.mkshrc</tt> then run <tt>mksh</tt>; this
285 Title: On startup files and <tt>$ENV</tt> across and detecting various shells
287 Interactive shells look at <tt>~/.mkshrc</tt> (or <tt>/system/etc/mkshrc</tt>
288 on Android and <tt>/etc/mkshrc</tt> on FreeWRT and OpenWrt) by default. This
289 location can, however, be overridden by setting the <tt>ENV</tt> environment
291 to not set <tt>$ENV</tt> if possible and let every shell user their native
293 <tt>$BASH_VERSION</tt> (GNU bash), <tt>$KSH_VERSION</tt> (contains “LEGACY KSH”
295 for ksh93); <tt>$NETBSD_SHELL</tt> (NetBSD ash); <tt>POSH_VERSION</tt> (posh, a
296 pdksh derivative); <tt>$SH_VERSION</tt> (“PD KSH” as sh), <tt>$YASH_VERSION</tt>
297 (yash), <tt>$ZSH_VERSION</tt> (or if <tt>$VERSION</tt> begins with “zsh”); a <a
304 <tt>bind '^L=clear-screen'</tt>
310 <tt>bind -m ^U='^[0^K'</tt>
319 <tt>bind '^XA=search-history-up'</tt>
325 pipelines and delays (<tt>cmd1 | (cmd2; sleep 3; cmd3) | cmd4</tt>).
329 script</a> and <tt>source</tt> it. For merging into your <tt>~/.mkshrc</tt>
330 you should first understand how it works: lines 4–18 set a <tt>PS1</tt>
331 (prompt) equivalent to lines 84–96 of the stock <tt>dot.mkshrc</tt>, with
332 one change: line 15 (<tt>print &gt;/dev/tty …</tt>) is new, inserted just
333 before the <tt>return</tt> command of the function substitution in the
347 <p>Normally: <tt>mksh -T<i>/dev/tty2</i></tt></p>
350 <tt>mksh -T!<i>/dev/ttyACM0</i></tt></p>
352 <tt>mksh -T- -c 'exec cdio lock'</tt></p>
359 command line editor macro, and using the <tt>evaluate-region</tt>
360 editor command (modulo a bugfix) together with <tt>quote-region</tt> and shell functions to
368 <p>You’ll need to use the <tt>lksh</tt> binary, unless your C <tt>long</tt>
370 because <tt>mksh</tt> provides consistent, wraparound-defined, 32-bit
372 (<tt>set -o posix</tt>) explicitly, which also disables brace expansion upon
373 being enabled (use <tt>set -o braceexpand</tt> to reenable if needed).</p>
374 <p>For the purpose of POSIX, mksh supports only the <tt>C</tt> locale. mksh’s
375 <tt>utf8-mode</tt> (which only supports the BMP (Basic Multilingual Plane) of
377 <tt>Arithmetic expressions</tt> in mksh(1) for details) <em>must</em> stay
380 <tt>utf8-mode</tt> option dependent on the current POSIX locale, for mksh
395 <p>The shell is pretty close to POSIX, when run as <tt>lksh -o posix</tt>
402 <p><tt>mksh</tt> has a different scope model from AT&amp;T <tt>ksh</tt>,
404 This can cause issues with a <tt>nameref</tt> to suddenly point to a
407 <p class="boxhead">GNU <tt>bash</tt> allows unsetting local variables; in
408 <tt>mksh</tt>, doing so in a function allows back access to the global
411 of <tt>unset</tt> to behave like other shells (the alias can be removed
429 <tt>local</tt>, <tt>typeset</tt>, <tt>integer</tt> or
430 <tt>\\builtin typeset</tt>) it does not, like in other shells, inherit
438 <tt>[[ foo =~ (foo|bar).*baz ]]</tt><br />
440 <tt>[[ foo = *@(foo|bar)*baz* ]]</tt></p>
445 <p>GNU <tt>bash</tt> supports “<tt>&amp;&gt;</tt>” (and “|&amp;”) to redirect
450 <tt>foo |&amp; bar |&amp; baz &amp;&gt;log</tt>
453 <tt>foo 2&gt;&amp;1 | bar 2&gt;&amp;1 | baz &gt;log 2&gt;&amp;1</tt>
468 </div><p class="boxfoot">Note that <tt>exit</tt> in the inner loop will
470 code is inside a function, <tt>return</tt> in the inner loop will only
479 </div><p class="boxfoot">If <tt>read</tt> is run in a way such as
480 <tt>while read foo; do ...; done</tt> then leading whitespace will be
482 <tt>while IFS= read -r foo; do ...; done</tt> for pristine I/O.</p>
483 <p class="boxhead">Similarly, when using the <tt>-a</tt> option, use of the
484 <tt>-r</tt> option might be prudent (<tt>read -raN-1 arr &lt;file</tt>);
499 <tt>alias command='command '</tt><br />
500 put this into your <tt>~/.mkshrc</tt>
506 <p>There’s a <tt>rename</tt> built-in utility in mksh, which is a very
510 <p>The GNU package <tt>util-linux</tt> has a different <tt>rename</tt>
512 builtin), you can use <tt>dot.mkshrc</tt>’s function <tt>enable</tt>
513 or put the following into your <tt>~/.mkshrc</tt>:</p>
519 <p>mksh contains a <tt>sleep</tt> built-in utility, in order to be
525 builtin), you can use <tt>dot.mkshrc</tt>’s function <tt>enable</tt>
526 or put something along the following lines into <tt>~/.mkshrc</tt>:</p>
538 <p>In POSIX shell, “=” in code like <tt>var=content</tt> is a string
539 assignment, always. You can use <tt>var=$((content))</tt> for an
542 <tt>var+=content</tt> would always do string concatenation; it does
543 in mksh, but not in some other shells, in which, when <tt>var</tt> has
545 <p>You can make the code portable by using “((…))” (a.k.a. <tt>let</tt>)
546 instead: <tt>(( var += content ))</tt> does arithmetic addition in
552 <p>I personally recommend people to not use “<tt>set -e</tt>”, as it
555 and the user has to make sure <tt>$?</tt> is always 0 ASAP even after
565 <p>This can be fixed by either adding an explicit “<tt>:</tt>” (or
566 “<tt>true</tt>”) after the comparison, or even…</p>
568 <p>… or right after the <tt>done</tt> inside the function, but…</p>
570 <p>… negating the condition and using “<tt>||</tt>” is preferable.</p>
572 <p>Remember that Korn shell-style functions (with <tt>function</tt>
580 still the last errorlevel inside, so an explicit true (“<tt>:</tt>”)
581 or, more explicitly, “<tt>return 0</tt>” at its end is still needed
582 if the <em>caller</em> runs under <tt>set -e</tt>.</p>
588 <tt>set -o pipefail</tt> makes the following construct error out:</p>
596 </div><p class="boxfoot">This is because, while the <tt>&amp;&amp;</tt>
598 <tt>for</tt>‥<tt>done</tt> loop’s errorlevel, which is passed on by
599 <tt>-o pipefail</tt>.</p>
601 <tt>true || echo $x</tt></p>
607 href="@@RELPATH@@ksh-chan.htm">homepage of the <tt>#ksh</tt> IRC channel
615 You can say hi in the <tt>#!/bin/mksh</tt> channel on Freenode <a