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 |
|
32 | OSH:
|
33 |
|
34 | - [`$?`](chap-special-var.html#POSIX-special) - not idiomatic in YSH
|
35 |
|
36 | ### Environment Variables
|
37 |
|
38 | YSH:
|
39 |
|
40 | - [ENV](chap-special-var.html#ENV)
|
41 | - `[simple-command][]` - for `NAME=val` env
|
42 | bindings
|
43 | - TODO: should we have a `envFromDict()` function that goes with `env -i`?
|
44 |
|
45 | OSH:
|
46 |
|
47 | - [`export`](chap-osh-assign.html#export)
|
48 |
|
49 | [simple-command]: chap-cmd-lang.html#simple-command
|
50 |
|
51 | ### I/O
|
52 |
|
53 | YSH:
|
54 |
|
55 | - [`write`](chap-builtin-cmd.html#write)
|
56 | - [`echo`](chap-builtin-cmd.html#ysh-echo) is a shortcut for `write`
|
57 | - [`read`](chap-builtin-cmd.html#ysh-read) - `read --all`, etc.
|
58 | - [`redir`](chap-builtin-cmd.html#redir)
|
59 | - The [`io`](chap-type-method.html#io) object
|
60 |
|
61 | OSH:
|
62 |
|
63 | - [`printf`](chap-builtin-cmd.html#printf)
|
64 |
|
65 | ### Procs
|
66 |
|
67 | YSH:
|
68 |
|
69 | - [`proc`](chap-ysh-cmd.html#proc)
|
70 | - Invokable objects: [`__invoke__`][__invoke__], [`Obj`][Obj]
|
71 | - [`simple-command`][simple-command] is how you invoke procs
|
72 |
|
73 | OSH:
|
74 |
|
75 | - [`sh-func`](chap-cmd-lang.html#sh-func)
|
76 |
|
77 | ### Modules
|
78 |
|
79 | - [`use`](chap-builtin-cmd.html#use)
|
80 | - [`is-main`](chap-builtin-cmd.html#is-main)
|
81 | - provide (TODO)
|
82 | - [`__provide__`](chap-special-var.html#__provide__)
|
83 | - An imported module is an [`Obj`][Obj] with an [`__invoke__`][__invoke__]
|
84 | method
|
85 |
|
86 | [Obj]: chap-type-method.html#Obj
|
87 | [__invoke__]: chap-type-method.html#__invoke__
|
88 |
|
89 | OSH:
|
90 |
|
91 | - [`source`](chap-builtin-cmd.html#source)
|
92 | - [`source-guard`](chap-builtin-cmd.html#source-guard)
|
93 |
|
94 | ### Unicode
|
95 |
|
96 | - TODO: which functions respect Unicode?
|
97 |
|
98 | Also see [the Unicode doc](../unicode.html).
|
99 |
|
100 | ### Interactive Shell
|
101 |
|
102 | - [`renderPrompt()`](chap-plugin.html#renderPrompt)
|
103 |
|
104 | OSH:
|
105 |
|
106 | - [`complete`][complete]
|
107 | - Oils enhancements: [`compexport`][compexport], [`compadjust`][compadjust]
|
108 |
|
109 | [complete]: chap-builtin-cmd.html#complete
|
110 | [compadjust]: chap-builtin-cmd.html#compadjust
|
111 | [compexport]: chap-builtin-cmd.html#compexport
|
112 |
|
113 |
|
114 |
|
115 | ## YSH Only
|
116 |
|
117 | ### Objects
|
118 |
|
119 | - [`Obj`][Obj]
|
120 | - `propView()` and `prototype()` - may be renamed `first() rest()`
|
121 | - operator `.` [ysh-attr](chap-expr-lang.html#ysh-attr)
|
122 | - operator `->` [thin-arrow](chap-expr-lang.html#thin-arrow)
|
123 |
|
124 | ### Closures
|
125 |
|
126 | - [block-arg](chap-cmd-lang.html#block-arg)
|
127 | - Maybe: proc, func
|
128 |
|
129 | ### Funcs
|
130 |
|
131 | - [`func`](chap-ysh-cmd.html#func)
|
132 | - Callable objects: [`__call__`][__call__] and [`Obj`][Obj] (TODO)
|
133 | - [`ysh-func-call`](chap-expr-lang.html#ysh-func-call)
|
134 |
|
135 | [__call__]: chap-type-method.html#__call__
|
136 |
|
137 | ### Reflection
|
138 |
|
139 | - The [`io`][io] object has `eval()` methods, etc.
|
140 | - The [`vm`][vm] object for inspecting interpreter structures
|
141 |
|
142 | [io]: chap-type-method.html#io
|
143 | [vm]: chap-type-method.html#vm
|
144 |
|