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

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