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

235 lines, 202 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 [Conditional] cmd/true cmd/false colon :
70 [Introspection] help hash cmd/type X caller
71 [Word Lookup] command builtin
72 [Interactive] alias unalias history X fc X bind
73X [Unsupported] enable
74```
75
76<h2 id="stdlib">
77 Standard Library <a class="group-link" href="chap-stdlib.html">stdlib</a>
78</h2>
79
80```chapter-links-stdlib
81 [two] log die
82 [no-quotes] nq-assert nq-run
83 nq-capture nq-capture-2
84 nq-redir nq-redir-2
85 [bash-strict]
86 [task-five]
87```
88
89<h2 id="front-end">
90 Front End <a class="group-link" href="chap-front-end.html">front-end</a>
91</h2>
92
93```chapter-links-front-end
94 [Usage] oils-usage osh-usage config
95 startup line-editing exit-codes
96 [Lexing] comment # line-continuation \ ascii-whitespace [ \t\r\n]
97```
98
99<h2 id="cmd-lang">
100 Command Language <a class="group-link" href="chap-cmd-lang.html">cmd-lang</a>
101</h2>
102
103```chapter-links-cmd-lang
104 [Commands] simple-command prefix-binding
105 semicolon ;
106 [Conditional] case if dbracket [[
107 bang ! and && or ||
108 [Iteration] while until for for-expr-sh ((
109 [Control Flow] break continue return exit
110 [Grouping] sh-func sh-block { subshell (
111 [Concurrency] pipe | X pipe-amp |& ampersand &
112 [Redirects] redir-file > >> >| < <> not impl: &>
113 redir-desc >& <&
114 here-doc << <<-
115 here-str <<<
116 [Other Command] dparen (( time X coproc X select
117```
118
119<h2 id="osh-assign">
120 Assignments and Expressions <a class="group-link" href="chap-osh-assign.html">osh-assign</a>
121</h2>
122
123```chapter-links-osh-assign
124 [Literals] sh-array array=(a b c) array[1]=B "${a[@]}"
125 sh-assoc assoc=(['a']=1 ['b']=2) assoc['x']=b
126 [Operators] sh-assign str='xyz'
127 sh-append str+='abc'
128 [Builtins] local readonly export unset shift
129 declare typeset X let
130```
131
132<h2 id="word-lang">
133 Word Language <a class="group-link" href="chap-word-lang.html">word-lang</a>
134</h2>
135
136<!-- linkify_stop_col is 33 -->
137
138```chapter-links-word-lang_33
139 [Quotes] osh-string 'abc' $'line\n' "$var"
140 [Substitutions] command-sub $(command) `command`
141 var-sub ${var} $0 $9
142 arith-sub $((1 + 2))
143 tilde-sub ~/src
144 proc-sub diff <(sort L.txt) <(sort R.txt)
145 [Var Ops] op-test ${x:-default}
146 op-strip ${x%%suffix} etc.
147 op-patsub ${x//y/z}
148 op-index ${a[i+1}
149 op-slice ${a[@]:0:1}
150 op-format ${x@P}
151```
152
153<h2 id="mini-lang">
154 Other Mini Languages <a class="group-link" href="chap-mini-lang.html">mini-lang</a>
155</h2>
156
157<!-- linkify_stop_col is 33 -->
158
159```chapter-links-mini-lang_33
160 [Arithmetic] arith-context Where legacy arithmetic is allowed
161 sh-numbers 0xFF 0755 etc.
162 sh-arith 1 + 2*3 a *= 2
163 sh-logical !a && b
164 sh-bitwise ~a ^ b
165 [Boolean] bool-expr [[ ! $x && $y || $z ]]
166 test ! $x -a $y -o $z
167 bool-infix $a -nt $b $x == $y
168 bool-path -d /etc
169 bool-str -n foo -z ''
170 bool-other -o errexit -v name[index]
171 [Patterns] glob-pat *.py
172 extglob ,(*.py|*.sh)
173 regex [[ foo =~ [a-z]+ ]]
174 [Other Sublang] braces {alice,bob}@example.com
175 histsub !$ !! !n
176 char-escapes \t \c \x00 \u03bc
177```
178
179<h2 id="option">
180 Global Shell Options <a class="group-link" href="chap-option.html">option</a>
181</h2>
182
183<!-- linkify_stop_col is 20 since we only want section links -->
184
185```chapter-links-option_22
186 [Errors] nounset -u errexit -e inherit_errexit pipefail
187 [Globbing] noglob -f nullglob failglob X dotglob
188 dashglob (true)
189 [Other Option] noclobber -C errtrace -E
190 [Debugging] xtrace X verbose X extdebug
191 [Interactive] emacs vi
192 [Compat] eval_unsafe_arith ignore_flags_not_impl
193 ignore_shopt_not_impl
194```
195
196<h2 id="special-var">
197 Special Variables <a class="group-link" href="chap-special-var.html">special-var</a>
198</h2>
199
200```chapter-links-special-var
201 [Oils VM] OILS_VERSION LIB_OSH
202 [POSIX Special] $@ $* $# $? $- $$ $! $0 $9
203 [Shell Vars] IFS X LANG X GLOBIGNORE
204 [Shell Options] SHELLOPTS X BASHOPTS
205 [Other Env] HOME PATH
206 [Other Special] BASH_REMATCH @PIPESTATUS
207 [Platform] HOSTNAME OSTYPE
208 [Call Stack] @BASH_SOURCE @FUNCNAME @BASH_LINENO
209 X @BASH_ARGV X @BASH_ARGC
210 [Tracing] LINENO
211 [Process State] UID EUID PPID X BASHPID
212X [Process Stack] BASH_SUBSHELL SHLVL
213X [Shell State] BASH_CMDS @DIRSTACK
214 [Completion] @COMP_WORDS COMP_CWORD COMP_LINE COMP_POINT
215 COMP_WORDBREAKS @COMPREPLY X COMP_KEY
216 X COMP_TYPE COMP_ARGV
217 [History] HISTFILE
218 [cd] PWD OLDPWD X CDPATH
219 [getopts] OPTIND OPTARG X OPTERR
220 [read] REPLY
221 [Functions] X RANDOM SECONDS
222```
223
224<h2 id="plugin">
225 Plugins and Hooks <a class="group-link" href="chap-plugin.html">plugin</a>
226</h2>
227
228```chapter-links-plugin
229 [Signals] SIGTERM SIGINT SIGQUIT
230 SIGTTIN SIGTTOU SIGWINCH
231 [Traps] DEBUG ERR EXIT X RETURN
232 [Words] PS1 X PS2 X PS3 PS4
233 [Completion] complete
234 [Other Plugin] PROMPT_COMMAND X command_not_found
235```