OILS / doc / ref / toc-osh.md View on Github | oilshell.org

231 lines, 198 significant
1---
2title: OSH Table of Contents
3all_docs_url: ..
4css_files: ../../web/base.css ../../web/manual.css ../../web/ref-index.css
5preserve_anchor_case: yes
6---
7
8<div class="doc-ref-header">
9
10[Oils Reference](index.html) &mdash;
11**OSH Table of Contents** | [YSH](toc-ysh.html) | [Data Notation](toc-data.html)
12
13</div>
14
15[OSH]($xref) is a POSIX- and [bash]($xref)-compatible shell.
16
17<!--
18<div class="custom-toc">
19
20[OSH Types](#type-method) <br/>
21[Builtin Commands](#builtin-cmd) <br/>
22[Front End](#front-end) <br/>
23[Command Language](#cmd-lang) <br/>
24[OSH Assignment](#osh-assign) <br/>
25[Word Language](#word-lang) <br/>
26[Mini Languages](#mini-lang) <br/>
27[Shell Options](#option) <br/>
28[Special Variables](#special-var) <br/>
29[Plugins and Hooks](#plugin) <br/>
30
31[type-method](#type-method) &nbsp;
32[builtin-cmd](#builtin-cmd) &nbsp;
33[front-end](#front-end) &nbsp;
34[cmd-lang](#cmd-lang) &nbsp;
35[osh-assign](#osh-assign) &nbsp;
36[word-lang](#word-lang) &nbsp;
37[mini-lang](#mini-lang) &nbsp;
38[option](#option) &nbsp;
39[special-var](#special-var) &nbsp;
40[plugin](#plugin)
41
42</div>
43-->
44
45<h2 id="type-method">
46 OSH Types <a class="group-link" href="chap-type-method.html">type-method</a>
47</h2>
48
49```chapter-links-type-method
50 [OSH] BashArray BashAssoc
51```
52
53<h2 id="builtin-cmd">
54 Builtin Commands <a class="group-link" href="chap-builtin-cmd.html">builtin-cmd</a>
55</h2>
56
57```chapter-links-builtin-cmd
58 [I/O] read echo printf
59 readarray mapfile
60 [Run Code] source . eval trap
61 [Set Options] set shopt
62 [Working Dir] cd pwd pushd popd dirs
63 [Completion] complete compgen compopt compadjust compexport
64 [Shell Process] exec X logout
65 umask ulimit times
66 [Child Process] jobs wait
67 fg X bg X kill X disown
68 [External] test [ getopts
69 [Introspection] help hash cmd/type X caller
70 [Word Lookup] command builtin
71 [Interactive] alias unalias history X fc X bind
72X [Unsupported] enable
73```
74
75<h2 id="stdlib">
76 Standard Library <a class="group-link" href="chap-stdlib.html">stdlib</a>
77</h2>
78
79```chapter-links-stdlib
80 [bash-strict]
81 [two] log die
82 [no-quotes] nq-capture nq-capture-2 nq-assert
83 [byo-server] byo-maybe-run byo-must-run
84 [task-five]
85```
86
87<h2 id="front-end">
88 Front End <a class="group-link" href="chap-front-end.html">front-end</a>
89</h2>
90
91```chapter-links-front-end
92 [Usage] oils-usage osh-usage config
93 startup line-editing exit-codes
94 [Lexing] comment # line-continuation \ ascii-whitespace [ \t\r\n]
95```
96
97<h2 id="cmd-lang">
98 Command Language <a class="group-link" href="chap-cmd-lang.html">cmd-lang</a>
99</h2>
100
101```chapter-links-cmd-lang
102 [Commands] simple-command semicolon ;
103 [Conditional] case if dbracket [[
104 true false colon :
105 bang ! and && or ||
106 [Iteration] while until for for-expr-sh ((
107 [Control Flow] break continue return exit
108 [Grouping] sh-func sh-block { subshell (
109 [Concurrency] pipe | X pipe-amp |& ampersand &
110 [Redirects] redir-file > >> >| < <> not impl: &>
111 redir-desc >& <&
112 here-doc << <<- <<<
113 [Other Command] dparen (( time X coproc X select
114```
115
116<h2 id="osh-assign">
117 Assignments and Expressions <a class="group-link" href="chap-osh-assign.html">osh-assign</a>
118</h2>
119
120```chapter-links-osh-assign
121 [Literals] sh-array array=(a b c) array[1]=B "${a[@]}"
122 sh-assoc assoc=(['a']=1 ['b']=2) assoc['x']=b
123 [Operators] sh-assign str='xyz'
124 sh-append str+='abc'
125 [Builtins] local readonly export unset shift
126 declare typeset X let
127```
128
129<h2 id="word-lang">
130 Word Language <a class="group-link" href="chap-word-lang.html">word-lang</a>
131</h2>
132
133<!-- linkify_stop_col is 33 -->
134
135```chapter-links-word-lang_33
136 [Quotes] osh-string 'abc' $'line\n' "$var"
137 [Substitutions] command-sub $(command) `command`
138 var-sub ${var} $0 $9
139 arith-sub $((1 + 2))
140 tilde-sub ~/src
141 proc-sub diff <(sort L.txt) <(sort R.txt)
142 [Var Ops] op-test ${x:-default}
143 op-strip ${x%%suffix} etc.
144 op-replace ${x//y/z}
145 op-index ${a[i+1}
146 op-slice ${a[@]:0:1}
147 op-format ${x@P}
148```
149
150<h2 id="mini-lang">
151 Other Mini Languages <a class="group-link" href="chap-mini-lang.html">mini-lang</a>
152</h2>
153
154<!-- linkify_stop_col is 33 -->
155
156```chapter-links-mini-lang_33
157 [Arithmetic] arith-context Where legacy arithmetic is allowed
158 sh-numbers 0xFF 0755 etc.
159 sh-arith 1 + 2*3 a *= 2
160 sh-logical !a && b
161 sh-bitwise ~a ^ b
162 [Boolean] bool-expr [[ ! $x && $y || $z ]]
163 test ! $x -a $y -o $z
164 bool-infix $a -nt $b $x == $y
165 bool-path -d /etc
166 bool-str -n foo -z ''
167 bool-other -o errexit -v name[index]
168 [Patterns] glob-pat *.py
169 extglob ,(*.py|*.sh)
170 regex [[ foo =~ [a-z]+ ]]
171 [Other Sublang] braces {alice,bob}@example.com
172 histsub !$ !! !n
173 char-escapes \t \c \x00 \u03bc
174```
175
176<h2 id="option">
177 Global Shell Options <a class="group-link" href="chap-option.html">option</a>
178</h2>
179
180<!-- linkify_stop_col is 20 since we only want section links -->
181
182```chapter-links-option_22
183 [Errors] nounset -u errexit -e inherit_errexit pipefail
184 [Globbing] noglob -f nullglob failglob X dotglob
185 dashglob (true)
186 [Debugging] xtrace X verbose X extdebug
187 [Interactive] emacs vi
188 [Other POSIX] X noclobber
189 [Compat] eval_unsafe_arith ignore_flags_not_impl
190```
191
192<h2 id="special-var">
193 Special Variables <a class="group-link" href="chap-special-var.html">special-var</a>
194</h2>
195
196```chapter-links-special-var
197 [POSIX Special] $@ $* $# $? $- $$ $! $0 $9
198 [Shell Vars] IFS X LANG X GLOBIGNORE
199 [Shell Options] SHELLOPTS X BASHOPTS
200 [Other Env] HOME PATH
201 [Other Special] BASH_REMATCH @PIPESTATUS
202 [Platform] HOSTNAME OSTYPE
203 [Call Stack] @BASH_SOURCE @FUNCNAME @BASH_LINENO
204 X @BASH_ARGV X @BASH_ARGC
205 [Tracing] LINENO
206 [Process State] UID EUID PPID X BASHPID
207X [Process Stack] BASH_SUBSHELL SHLVL
208X [Shell State] BASH_CMDS @DIRSTACK
209 [Completion] @COMP_WORDS COMP_CWORD COMP_LINE COMP_POINT
210 COMP_WORDBREAKS @COMPREPLY X COMP_KEY
211 X COMP_TYPE COMP_ARGV
212 [History] HISTFILE
213 [cd] PWD OLDPWD X CDPATH
214 [getopts] OPTIND OPTARG X OPTERR
215 [read] REPLY
216 [Functions] X RANDOM SECONDS
217 [Oils VM] OILS_VERSION LIB_OSH
218```
219
220<h2 id="plugin">
221 Plugins and Hooks <a class="group-link" href="chap-plugin.html">plugin</a>
222</h2>
223
224```chapter-links-plugin
225 [Signals] SIGTERM SIGINT SIGQUIT
226 SIGTTIN SIGTTOU SIGWINCH
227 [Traps] DEBUG ERR EXIT X RETURN
228 [Words] PS1 X PS2 X PS3 PS4
229 [Completion] complete
230 [Other Plugin] PROMPT_COMMAND X command_not_found
231```