| 1 | ---
|
| 2 | title: YSH and OSH Topics by Feature
|
| 3 | all_docs_url: ..
|
| 4 | default_highlighter: oils-sh
|
| 5 | preserve_anchor_case: yes
|
| 6 | ---
|
| 7 |
|
| 8 | YSH and OSH Topics by Feature
|
| 9 | ====
|
| 10 |
|
| 11 | <span class="in-progress">(in progress)</span>
|
| 12 |
|
| 13 | This page links to topics in the [Oils Reference](index.html). It's organized
|
| 14 | differently than the [YSH Table of Contents](toc-ysh.html) or [OSH Table of
|
| 15 | Contents](toc-osh.html).
|
| 16 |
|
| 17 | <div id="toc">
|
| 18 | </div>
|
| 19 |
|
| 20 | ## Where YSH Improves on OSH
|
| 21 |
|
| 22 | ### Errors
|
| 23 |
|
| 24 | YSH:
|
| 25 |
|
| 26 | - [`try`](chap-builtin-cmd.html#try)
|
| 27 | - [`_error`](chap-special-var.html#_error)
|
| 28 | - multiple processes
|
| 29 | - [`_pipeline_status`](chap-special-var.html#_pipeline_status)
|
| 30 | - [`_process_sub_status`](chap-special-var.html#_process_sub_status)
|
| 31 | - [Options](chap-option.html):
|
| 32 | - `strict_errexit`, `command_sub_errexit`, ...
|
| 33 |
|
| 34 | OSH:
|
| 35 |
|
| 36 | - [`$?`](chap-special-var.html#POSIX-special) - not idiomatic in YSH
|
| 37 | - [Options](chap-option.html):
|
| 38 | - `errexit`, `pipefail`, `inherit_errexit`
|
| 39 |
|
| 40 | ### Environment Variables
|
| 41 |
|
| 42 | YSH:
|
| 43 |
|
| 44 | - [`ENV`][ENV]
|
| 45 | - [`ysh-prefix-binding`][ysh-prefix-binding] - for `NAME=val` env bindings
|
| 46 | - [`simple-command`][simple-command] - external commands are started with an
|
| 47 | `environ`
|
| 48 | - [Options](chap-option.html):
|
| 49 | - `shopt --unset no_exported`
|
| 50 | - `shopt --set env_obj`
|
| 51 |
|
| 52 | [ENV]: chap-special-var.html#ENV
|
| 53 |
|
| 54 | <!--
|
| 55 | TODO: should we have a `envFromDict()` function that goes with `env -i`?
|
| 56 | -->
|
| 57 |
|
| 58 | OSH:
|
| 59 |
|
| 60 | - [`export`](chap-osh-assign.html#export)
|
| 61 | - [`prefix-binding`][prefix-binding] - for `NAME=val` env bindings
|
| 62 |
|
| 63 | [prefix-binding]: chap-cmd-lang.html#prefix-binding
|
| 64 | [ysh-prefix-binding]: chap-cmd-lang.html#ysh-prefix-binding
|
| 65 |
|
| 66 | [simple-command]: chap-cmd-lang.html#simple-command
|
| 67 |
|
| 68 |
|
| 69 | ### I/O
|
| 70 |
|
| 71 | YSH:
|
| 72 |
|
| 73 | - [`write`](chap-builtin-cmd.html#write)
|
| 74 | - [`ysh-echo`](chap-builtin-cmd.html#ysh-echo) is a shortcut for `write`
|
| 75 | - [`ysh-read`](chap-builtin-cmd.html#ysh-read) - `read --all`, etc.
|
| 76 | - [`redir`](chap-builtin-cmd.html#redir)
|
| 77 | - The [`io`](chap-type-method.html#io) object
|
| 78 |
|
| 79 | OSH:
|
| 80 |
|
| 81 | - [`printf`](chap-builtin-cmd.html#printf)
|
| 82 |
|
| 83 | ### Procs
|
| 84 |
|
| 85 | YSH:
|
| 86 |
|
| 87 | - [`proc`](chap-ysh-cmd.html#proc)
|
| 88 | - Invokable objects: [`__invoke__`][__invoke__], [`Obj`][Obj]
|
| 89 | - [`simple-command`][simple-command] is how you invoke procs
|
| 90 |
|
| 91 | OSH:
|
| 92 |
|
| 93 | - [`sh-func`](chap-cmd-lang.html#sh-func)
|
| 94 |
|
| 95 | ### Modules
|
| 96 |
|
| 97 | - [`use`](chap-builtin-cmd.html#use)
|
| 98 | - [`is-main`](chap-builtin-cmd.html#is-main)
|
| 99 | - provide (TODO)
|
| 100 | - [`_this_dir`](chap-special-var.html#_this_dir)
|
| 101 | - [`__provide__`](chap-special-var.html#__provide__)
|
| 102 | - An imported module is an [`Obj`][Obj] with an [`__invoke__`][__invoke__]
|
| 103 | method
|
| 104 |
|
| 105 | [Obj]: chap-type-method.html#Obj
|
| 106 | [__invoke__]: chap-type-method.html#__invoke__
|
| 107 |
|
| 108 | OSH:
|
| 109 |
|
| 110 | - [`source`](chap-builtin-cmd.html#source)
|
| 111 | - [`source-guard`](chap-builtin-cmd.html#source-guard)
|
| 112 |
|
| 113 | ### Interactive Shell
|
| 114 |
|
| 115 | - [`renderPrompt()`](chap-plugin.html#renderPrompt)
|
| 116 |
|
| 117 | OSH:
|
| 118 |
|
| 119 | - [`complete`][complete]
|
| 120 | - Oils enhancements: [`compexport`][compexport], [`compadjust`][compadjust]
|
| 121 |
|
| 122 | [complete]: chap-builtin-cmd.html#complete
|
| 123 | [compadjust]: chap-builtin-cmd.html#compadjust
|
| 124 | [compexport]: chap-builtin-cmd.html#compexport
|
| 125 |
|
| 126 | ### Tracing
|
| 127 |
|
| 128 | - `set -x` aka `set -o xtrace`
|
| 129 | - [PS4][]
|
| 130 | - `SHX_*`
|
| 131 |
|
| 132 | [PS4]: chap-plugin.html#PS4
|
| 133 |
|
| 134 | ### Unicode
|
| 135 |
|
| 136 | - TODO: which functions respect Unicode?
|
| 137 |
|
| 138 | Also see [the Unicode doc](../unicode.html).
|
| 139 |
|
| 140 |
|
| 141 | ## YSH Only
|
| 142 |
|
| 143 | ### Objects
|
| 144 |
|
| 145 | - [`Obj`][Obj]
|
| 146 | - [`__invoke__`][__invoke__]
|
| 147 | - TODO: `__call__`
|
| 148 | - [`first()`][first] and [`rest()`][first]
|
| 149 | - [`ENV`][ENV] is an `Obj`
|
| 150 | - operator `.` [ysh-attr](chap-expr-lang.html#ysh-attr)
|
| 151 | - operator `->` [thin-arrow](chap-expr-lang.html#thin-arrow)
|
| 152 |
|
| 153 |
|
| 154 | [first]: chap-builtin-func.html#first
|
| 155 | [rest]: chap-builtin-func.html#rest
|
| 156 |
|
| 157 | ### Closures
|
| 158 |
|
| 159 | - [block-arg](chap-cmd-lang.html#block-arg)
|
| 160 | - Maybe: proc, func
|
| 161 |
|
| 162 | ### Funcs
|
| 163 |
|
| 164 | - [`func`](chap-ysh-cmd.html#func)
|
| 165 | - Callable objects: [`__call__`][__call__] and [`Obj`][Obj] (TODO)
|
| 166 | - [`ysh-func-call`](chap-expr-lang.html#ysh-func-call)
|
| 167 |
|
| 168 | [__call__]: chap-type-method.html#__call__
|
| 169 |
|
| 170 | ### Reflection
|
| 171 |
|
| 172 | - The [`io`][io] object has `eval()` methods, etc.
|
| 173 | - The [`vm`][vm] object for inspecting interpreter structures
|
| 174 |
|
| 175 | [io]: chap-type-method.html#io
|
| 176 | [vm]: chap-type-method.html#vm
|
| 177 |
|
| 178 | ### Namespaces
|
| 179 |
|
| 180 | - [`ENV`](chap-special-var.html#ENV)
|
| 181 | - [`__builtins__`](chap-special-var.html#__builtins__)
|
| 182 |
|
| 183 | <!--
|
| 184 |
|
| 185 | TODO:
|
| 186 |
|
| 187 | - __modules__
|
| 188 | - does vm.getFrame() belong?
|
| 189 |
|
| 190 | -->
|
| 191 |
|
| 192 |
|