@@ -31,8 +31,9 @@ This chapter describes command line usage and lexing.
31
31
```
32
32
bin/oils-for-unix is an executable that contains OSH, YSH, and more.
33
33
34
- Usage: oils-for-unix MAIN_NAME ARG*
35
- MAIN_NAME ARG*
34
+ Usage:
35
+ oils-for-unix MAIN_NAME ARG*
36
+ MAIN_NAME ARG*
36
37
37
38
It behaves like busybox. The command name can be passed as the first argument:
38
39
@@ -54,25 +55,16 @@ behave like that command:
54
55
```
55
56
bin/osh is compatible with POSIX shell, bash, and other shells.
56
57
57
- Usage: osh FLAG* SCRIPT ARG*
58
- osh FLAG* -c COMMAND ARG*
59
- osh FLAG*
60
-
61
- The command line accepted by `bin/osh` is compatible with /bin/sh and bash.
58
+ Usage:
59
+ osh FLAG* SCRIPT ARG*
60
+ osh FLAG* -c COMMAND ARG*
61
+ osh FLAG*
62
62
63
+ Examples:
63
64
osh -c 'echo hi'
64
65
osh myscript.sh
65
66
echo 'echo hi' | osh
66
67
67
- It also has a few enhancements:
68
-
69
- osh -n -c 'hello' # pretty-print the AST
70
- osh --ast-format text -n -c 'hello' # print it full
71
-
72
- osh accepts POSIX sh flags, with these additions:
73
-
74
- -n parse the program but don't execute it. Print the AST.
75
- --ast-format what format the AST should be in
76
68
```
77
69
78
70
<h3 id =" ysh-usage " class =" ysh-topic " oils-embed =" 1 " >
@@ -84,23 +76,47 @@ osh accepts POSIX sh flags, with these additions:
84
76
```
85
77
bin/ysh is the shell with data tYpes, influenced by pYthon, JavaScript, ...
86
78
87
- Usage: ysh FLAG* SCRIPT ARG*
88
- ysh FLAG* -c COMMAND ARG*
89
- ysh FLAG*
79
+ Usage:
80
+ ysh FLAG* SCRIPT ARG*
81
+ ysh FLAG* -c COMMAND ARG*
82
+ ysh FLAG*
90
83
91
84
Examples:
92
-
93
85
ysh -c 'echo hi'
94
86
ysh myscript.ysh
95
87
echo 'echo hi' | ysh
96
88
97
- bin/ysh is the same as bin/osh with a the ysh:all option group set. So bin/ysh
98
- also accepts shell flags. Examples:
89
+ Note that bin/ysh is the same as bin/osh with the ysh:all option group set:
90
+ osh -o ysh:all -c 'echo hi' # Same as YSH
91
+ ```
92
+
93
+ <h3 id =" shell-flags " oils-embed =" 1 " >
94
+ shell-flags
95
+ </h3 >
99
96
97
+ ```
98
+ osh and ysh accept standard POSIX shell flags, like:
99
+
100
+ bin/osh -o errexit -c 'false'
100
101
bin/ysh -n myfile.ysh
101
102
bin/ysh +o errexit -c 'false; echo ok'
102
- ```
103
103
104
+ They also accept these flags:
105
+
106
+ -n Parse the program but don't execute it. Print the AST.
107
+ --ast-format FMT The format for the AST (text|text-abbrev)
108
+ --eval FILE Evaluate the given file, similar to the 'source' builtin.
109
+ Specify it multiple times to run multiple files. The
110
+ shell stops on normal errors, as well as when $? is
111
+ non-zero after evaluating a file (even if errexit is
112
+ off).
113
+ --tool Run a tool instead of the shell (cat-em|syntax-tree)
114
+
115
+ Examples:
116
+
117
+ osh -n -c 'hello' # pretty-print the AST
118
+ ysh --ast-format text -n -c 'hello' # print it full
119
+ ```
104
120
105
121
<h3 id =" config " class =" osh-ysh-topic " >config</h3 >
106
122
@@ -123,7 +139,10 @@ Pass --norc to disable the startup directory.
123
139
124
140
<h3 id =" startup " class =" osh-ysh-topic " >startup</h3 >
125
141
126
- History is read?
142
+ TODO:
143
+
144
+ 1 . History is read
145
+ 1 . ...
127
146
128
147
<h3 id =" line-editing " class =" osh-ysh-topic " >line-editing</h3 >
129
148
@@ -302,6 +321,16 @@ Print files embedded in the `oils-for-unix` binary to stdout. Example:
302
321
303
322
osh --tool cat-em stdlib/math.ysh stdlib/other.ysh
304
323
324
+ ### syntax-tree
325
+
326
+ Print the syntax tree in a debug format.
327
+
328
+ osh --tool syntax-tree stdlib/ysh/math.ysh
329
+
330
+ The ` -n ` flag is a shortcut:
331
+
332
+ osh -n stdlib/ysh/math.ysh
333
+
305
334
306
335
## Help Chapters
307
336
0 commit comments