buninu 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -0
- package/README.md +334 -37
- package/apps/bunmsh/CHANGELOG.md +262 -0
- package/apps/bunmsh/LICENSE +21 -0
- package/apps/bunmsh/LICENSE-MKSH +295 -0
- package/apps/bunmsh/PORTING.md +192 -0
- package/apps/bunmsh/README.md +801 -0
- package/apps/bunmsh/bunmsh +7 -0
- package/apps/bunmsh/bunshell.md +61 -0
- package/apps/bunmsh/help/README.md +1945 -0
- package/apps/bunmsh/help/alias.md +22 -0
- package/apps/bunmsh/help/basename.md +38 -0
- package/apps/bunmsh/help/builtin.md +25 -0
- package/apps/bunmsh/help/bun.md +27 -0
- package/apps/bunmsh/help/bunmsh.md +47 -0
- package/apps/bunmsh/help/cat.md +31 -0
- package/apps/bunmsh/help/catfancy.md +35 -0
- package/apps/bunmsh/help/cd.md +22 -0
- package/apps/bunmsh/help/chmod.md +27 -0
- package/apps/bunmsh/help/clear.md +21 -0
- package/apps/bunmsh/help/colon.md +22 -0
- package/apps/bunmsh/help/command.md +27 -0
- package/apps/bunmsh/help/cp.md +28 -0
- package/apps/bunmsh/help/cut.md +25 -0
- package/apps/bunmsh/help/date.md +25 -0
- package/apps/bunmsh/help/dirname.md +25 -0
- package/apps/bunmsh/help/echo.md +25 -0
- package/apps/bunmsh/help/env.md +27 -0
- package/apps/bunmsh/help/eval.md +22 -0
- package/apps/bunmsh/help/exec.md +22 -0
- package/apps/bunmsh/help/exit.md +21 -0
- package/apps/bunmsh/help/export.md +22 -0
- package/apps/bunmsh/help/false.md +22 -0
- package/apps/bunmsh/help/find.md +33 -0
- package/apps/bunmsh/help/getopts.md +28 -0
- package/apps/bunmsh/help/grep.md +34 -0
- package/apps/bunmsh/help/head.md +27 -0
- package/apps/bunmsh/help/kill.md +27 -0
- package/apps/bunmsh/help/ln.md +28 -0
- package/apps/bunmsh/help/ls.md +37 -0
- package/apps/bunmsh/help/lsbun.md +29 -0
- package/apps/bunmsh/help/lsfancy.md +37 -0
- package/apps/bunmsh/help/md5sum.md +21 -0
- package/apps/bunmsh/help/mkdir.md +27 -0
- package/apps/bunmsh/help/mktemp.md +26 -0
- package/apps/bunmsh/help/mv.md +26 -0
- package/apps/bunmsh/help/print.md +30 -0
- package/apps/bunmsh/help/printf.md +25 -0
- package/apps/bunmsh/help/pwd.md +21 -0
- package/apps/bunmsh/help/read.md +27 -0
- package/apps/bunmsh/help/readonly.md +27 -0
- package/apps/bunmsh/help/realpath.md +21 -0
- package/apps/bunmsh/help/rm.md +33 -0
- package/apps/bunmsh/help/rmdir.md +27 -0
- package/apps/bunmsh/help/sed.md +29 -0
- package/apps/bunmsh/help/seq.md +29 -0
- package/apps/bunmsh/help/serve.md +50 -0
- package/apps/bunmsh/help/set.md +26 -0
- package/apps/bunmsh/help/sha256sum.md +21 -0
- package/apps/bunmsh/help/shift.md +23 -0
- package/apps/bunmsh/help/sleep.md +25 -0
- package/apps/bunmsh/help/sort.md +29 -0
- package/apps/bunmsh/help/source.md +23 -0
- package/apps/bunmsh/help/tab.md +30 -0
- package/apps/bunmsh/help/tac.md +29 -0
- package/apps/bunmsh/help/tail.md +27 -0
- package/apps/bunmsh/help/tee.md +25 -0
- package/apps/bunmsh/help/test.md +30 -0
- package/apps/bunmsh/help/time.md +29 -0
- package/apps/bunmsh/help/touch.md +26 -0
- package/apps/bunmsh/help/tr.md +26 -0
- package/apps/bunmsh/help/true.md +22 -0
- package/apps/bunmsh/help/type.md +21 -0
- package/apps/bunmsh/help/umask.md +22 -0
- package/apps/bunmsh/help/unalias.md +28 -0
- package/apps/bunmsh/help/uname.md +31 -0
- package/apps/bunmsh/help/unset.md +28 -0
- package/apps/bunmsh/help/wc.md +27 -0
- package/apps/bunmsh/help/whence.md +26 -0
- package/apps/bunmsh/help/which.md +41 -0
- package/apps/bunmsh/help/yes.md +23 -0
- package/apps/bunmsh/package.json +26 -0
- package/apps/bunmsh/serve.js +468 -0
- package/apps/bunmsh/single-exe/README.md +402 -0
- package/apps/bunmsh/single-exe/assetsHelper.js +371 -0
- package/apps/bunmsh/single-exe/assetsLoader.mjs +85 -0
- package/apps/bunmsh/single-exe/assetsPacker.js +218 -0
- package/apps/bunmsh/single-exe/compiled.js +527 -0
- package/apps/bunmsh/single-exe/entry.mjs +17 -0
- package/apps/bunmsh/src/cat-fancy.js +117 -0
- package/apps/bunmsh/src/cat-operands.js +31 -0
- package/apps/bunmsh/src/completion.js +247 -0
- package/apps/bunmsh/src/environment.js +61 -0
- package/apps/bunmsh/src/fancy-ls.js +186 -0
- package/apps/bunmsh/src/find.js +119 -0
- package/apps/bunmsh/src/history.js +198 -0
- package/apps/bunmsh/src/main.js +776 -0
- package/apps/bunmsh/src/mouse.js +103 -0
- package/apps/bunmsh/src/shell.js +3557 -0
- package/apps/bunmsh/test/catfancy.test.js +102 -0
- package/apps/bunmsh/test/reference-source.sh +1 -0
- package/apps/bunmsh/test/reference.test.js +677 -0
- package/apps/bunmsh/test/serve/README.md +3 -0
- package/apps/bunmsh/test/serve/bad.json +1 -0
- package/apps/bunmsh/test/serve/data.json +1 -0
- package/apps/bunmsh/test/serve/data.json5 +1 -0
- package/apps/bunmsh/test/serve/data.jsonc +2 -0
- package/apps/bunmsh/test/serve/data.jsonl +2 -0
- package/apps/bunmsh/test/serve/data.ndjson +1 -0
- package/apps/bunmsh/test/serve/data.toml +3 -0
- package/apps/bunmsh/test/serve/data.ts +15 -0
- package/apps/bunmsh/test/serve/data.xml +1 -0
- package/apps/bunmsh/test/serve/data.yaml +3 -0
- package/apps/bunmsh/test/serve/data.yml +1 -0
- package/apps/bunmsh/test/serve.test.js +241 -0
- package/apps/bunmsh/test/shell.test.js +1778 -0
- package/apps/bunmsh/test/t.sh +12 -0
- package/apps/cmdlist +6 -1
- package/apps/jsgotty/gotty.js +65 -76
- package/apps/jsgotty/package.json +6 -1
- package/apps/jsgotty/single-exe/README.md +358 -54
- package/apps/jsgotty/single-exe/assetsHelper.js +293 -12
- package/apps/jsgotty/single-exe/assetsLoader.mjs +1 -1
- package/apps/jsgotty/single-exe/assetsPacker.js +218 -0
- package/apps/jsgotty/single-exe/compiled.js +379 -19
- package/apps/jsgotty/single-exe/entry.mjs +16 -2
- package/apps/jsgotty/zmodem-node.js +14 -12
- package/apps/jsmdcui/CHANGELOG.md +56 -0
- package/apps/jsmdcui/package.json +12 -2
- package/apps/jsmdcui/single-exe/README.md +298 -375
- package/apps/jsmdcui/single-exe/assetsHelper.js +198 -18
- package/apps/jsmdcui/single-exe/assetsLoader.mjs +1 -1
- package/apps/jsmdcui/single-exe/assetsPacker.js +218 -0
- package/apps/jsmdcui/single-exe/compiled.js +291 -5
- package/apps/jsmdcui/single-exe/entry.mjs +7 -0
- package/apps/jsmdcui/src/index.js +11 -8
- package/apps/jsmdcui/tests/jmigt.js +16 -0
- package/bin/bunmsh.bat +3 -0
- package/bin/bunmsh.sh +5 -0
- package/bin/init.js +48 -5
- package/bin/install.js +541 -0
- package/package.json +4 -2
|
@@ -0,0 +1,1945 @@
|
|
|
1
|
+
## alias
|
|
2
|
+
|
|
3
|
+
Define or print aliases.
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
alias [NAME[=VALUE] ...]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Example
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
alias ll='builtin lsfancy -l'
|
|
15
|
+
alias ll
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Output:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
ll='builtin lsfancy -l'
|
|
22
|
+
```
|
|
23
|
+
## basename
|
|
24
|
+
|
|
25
|
+
Remove directory components and an optional suffix.
|
|
26
|
+
|
|
27
|
+
### Usage
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
basename [--] STRING [SUFFIX]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Options and forms
|
|
34
|
+
|
|
35
|
+
- `--`: Stop option parsing, allowing a string beginning with `-`.
|
|
36
|
+
- `SUFFIX`: Remove this exact suffix when it is present and is not the whole basename.
|
|
37
|
+
|
|
38
|
+
### Example
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
basename /usr/local/bin/bun
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Output:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
bun
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Suffix example:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
basename archive.tar.gz .gz
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Output:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
archive.tar
|
|
60
|
+
```
|
|
61
|
+
## builtin
|
|
62
|
+
|
|
63
|
+
Run a registered builtin explicitly; with no command, list builtin names.
|
|
64
|
+
|
|
65
|
+
### Usage
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
builtin [--] [COMMAND [ARG ...]]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Options and forms
|
|
72
|
+
|
|
73
|
+
- `--`: Stop builtin's own option parsing before the command name.
|
|
74
|
+
|
|
75
|
+
### Example
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
builtin echo hello
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Output:
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
hello
|
|
85
|
+
```
|
|
86
|
+
## bun
|
|
87
|
+
|
|
88
|
+
Invoke the active Bun runtime.
|
|
89
|
+
|
|
90
|
+
### Usage
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
bun [ARG ...]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Options and forms
|
|
97
|
+
|
|
98
|
+
All arguments are forwarded unchanged to the active Bun runtime. Bun's
|
|
99
|
+
supported flags depend on that runtime version; run the external `bun --help`
|
|
100
|
+
when its own complete CLI reference is required.
|
|
101
|
+
|
|
102
|
+
### Example
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
bun --version
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Output:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
1.4.0
|
|
112
|
+
```
|
|
113
|
+
## bunmsh
|
|
114
|
+
|
|
115
|
+
Invoke the active bunmsh entry point.
|
|
116
|
+
|
|
117
|
+
### Usage
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
bunmsh [ARG ...]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Options and forms
|
|
124
|
+
|
|
125
|
+
- `SCRIPT [ARG ...]`: Execute a shell script file.
|
|
126
|
+
- `-c SOURCE [ARG ...]`: Parse and execute shell source text.
|
|
127
|
+
- `-cc COMMAND [ARG ...]`: Execute argv directly without shell parsing or expansion.
|
|
128
|
+
- `-i`: Enter interactive mode after any requested command or script.
|
|
129
|
+
- `--mouse`: Enable terminal mouse events.
|
|
130
|
+
- `--builtin-only`: Disable PATH lookup while retaining builtins.
|
|
131
|
+
- `-V`, `--version`: Print the bunmsh version.
|
|
132
|
+
- `--readme`: Render the bundled README.
|
|
133
|
+
- `--changelog`: Render the bundled changelog.
|
|
134
|
+
- `--build-exe`: Build `./bmsh` for the current platform.
|
|
135
|
+
- `--build-for TARGET`: Cross-compile `./bmsh` for a target.
|
|
136
|
+
- `--`: Stop option parsing before a script path.
|
|
137
|
+
|
|
138
|
+
### Tar-backend asset controls
|
|
139
|
+
|
|
140
|
+
These options currently work only with the tar asset backend. They are not
|
|
141
|
+
available to builds that embed the asset directory directly with Bun's
|
|
142
|
+
`--asset` backend. See [single-exe/README.md](../single-exe/README.md) for the
|
|
143
|
+
backend comparison, build setup, and extraction layout.
|
|
144
|
+
|
|
145
|
+
- `--assets-list`: List embedded asset paths and exit.
|
|
146
|
+
- `--assets-extract`: Extract embedded assets beside the executable and exit.
|
|
147
|
+
- `--assets-external`: Ignore embedded assets and read the extracted files.
|
|
148
|
+
|
|
149
|
+
### Example
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
bunmsh -c 'echo hello'
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Output:
|
|
156
|
+
|
|
157
|
+
```text
|
|
158
|
+
hello
|
|
159
|
+
```
|
|
160
|
+
## cat
|
|
161
|
+
|
|
162
|
+
Concatenate files or stdin.
|
|
163
|
+
|
|
164
|
+
### Usage
|
|
165
|
+
|
|
166
|
+
```sh
|
|
167
|
+
cat [--exclude PATTERN]... [--] [FILE ...]
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Options and forms
|
|
171
|
+
|
|
172
|
+
- `--`: Stop option parsing.
|
|
173
|
+
- `--exclude PATTERN`/`--exclude=PATTERN`: Omit matching file operands using
|
|
174
|
+
`Bun.Glob` patterns. Repeat the option to exclude more patterns; quote a
|
|
175
|
+
pattern to prevent the shell from expanding it first.
|
|
176
|
+
- `-`: Read from stdin at that operand position. No other options are supported.
|
|
177
|
+
|
|
178
|
+
### Example
|
|
179
|
+
|
|
180
|
+
```sh
|
|
181
|
+
printf 'alpha\n' > alpha.txt
|
|
182
|
+
printf 'beta\n' > beta.txt
|
|
183
|
+
builtin cat --exclude 'alpha.*' *.txt
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Output:
|
|
187
|
+
|
|
188
|
+
```text
|
|
189
|
+
beta
|
|
190
|
+
```
|
|
191
|
+
## catfancy
|
|
192
|
+
|
|
193
|
+
Render Markdown and colorized parsed structured data; pass other formats through.
|
|
194
|
+
|
|
195
|
+
### Usage
|
|
196
|
+
|
|
197
|
+
```sh
|
|
198
|
+
catfancy [--exclude PATTERN]... [--] [FILE ...]
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Options and forms
|
|
202
|
+
|
|
203
|
+
- `--`: Stop option parsing.
|
|
204
|
+
- `--exclude PATTERN`/`--exclude=PATTERN`: Omit matching file operands using
|
|
205
|
+
`Bun.Glob` patterns. Repeat the option to exclude more patterns; quote a
|
|
206
|
+
pattern to prevent the shell from expanding it first.
|
|
207
|
+
- `-`: Read unformatted stdin; file previews are selected from filename extensions.
|
|
208
|
+
- `.js`/`.mjs`/`.cjs`/`.jsx` and `.ts`/`.mts`/`.cts`/`.tsx` files are wrapped
|
|
209
|
+
in a fenced ` ```javascript `/` ```typescript ` block and rendered through
|
|
210
|
+
`Bun.markdown.ansi`, for the same syntax coloring Markdown code blocks get.
|
|
211
|
+
|
|
212
|
+
### Example
|
|
213
|
+
|
|
214
|
+
```sh
|
|
215
|
+
builtin catfancy package.json
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Output:
|
|
219
|
+
|
|
220
|
+
```text
|
|
221
|
+
{
|
|
222
|
+
"name": "bunmsh",
|
|
223
|
+
"version": "0.1.10"
|
|
224
|
+
} # colorized
|
|
225
|
+
```
|
|
226
|
+
## cd
|
|
227
|
+
|
|
228
|
+
Change directory; cd - returns to the previous directory.
|
|
229
|
+
|
|
230
|
+
### Usage
|
|
231
|
+
|
|
232
|
+
```sh
|
|
233
|
+
cd [DIRECTORY]
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Example
|
|
237
|
+
|
|
238
|
+
```sh
|
|
239
|
+
cd /tmp
|
|
240
|
+
pwd
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Output:
|
|
244
|
+
|
|
245
|
+
```text
|
|
246
|
+
/tmp
|
|
247
|
+
```
|
|
248
|
+
## chmod
|
|
249
|
+
|
|
250
|
+
Change modes using octal values, +x, or a+x.
|
|
251
|
+
|
|
252
|
+
### Usage
|
|
253
|
+
|
|
254
|
+
```sh
|
|
255
|
+
chmod MODE FILE ...
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Options and forms
|
|
259
|
+
|
|
260
|
+
- Octal modes such as `755` set all permission bits.
|
|
261
|
+
- `+x` and `a+x` add executable bits.
|
|
262
|
+
|
|
263
|
+
### Example
|
|
264
|
+
|
|
265
|
+
```sh
|
|
266
|
+
chmod +x script.sh
|
|
267
|
+
builtin test -x script.sh; echo $?
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Output:
|
|
271
|
+
|
|
272
|
+
```text
|
|
273
|
+
0
|
|
274
|
+
```
|
|
275
|
+
## clear
|
|
276
|
+
|
|
277
|
+
Clear the terminal.
|
|
278
|
+
|
|
279
|
+
### Usage
|
|
280
|
+
|
|
281
|
+
```sh
|
|
282
|
+
clear
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Example
|
|
286
|
+
|
|
287
|
+
```sh
|
|
288
|
+
clear
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Output:
|
|
292
|
+
|
|
293
|
+
```text
|
|
294
|
+
(terminal screen is cleared)
|
|
295
|
+
```
|
|
296
|
+
## :
|
|
297
|
+
|
|
298
|
+
Do nothing and return success.
|
|
299
|
+
|
|
300
|
+
### Usage
|
|
301
|
+
|
|
302
|
+
```sh
|
|
303
|
+
: [ARG ...]
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Example
|
|
307
|
+
|
|
308
|
+
```sh
|
|
309
|
+
: ignored
|
|
310
|
+
echo $?
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Output:
|
|
314
|
+
|
|
315
|
+
```text
|
|
316
|
+
0
|
|
317
|
+
```
|
|
318
|
+
## command
|
|
319
|
+
|
|
320
|
+
Run or inspect a command while bypassing aliases.
|
|
321
|
+
|
|
322
|
+
### Usage
|
|
323
|
+
|
|
324
|
+
```sh
|
|
325
|
+
command [-pVv] COMMAND [ARG ...]
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Options and forms
|
|
329
|
+
|
|
330
|
+
- `-p`: Use bunmsh's default command PATH.
|
|
331
|
+
- `-v`: Print a concise lookup result.
|
|
332
|
+
- `-V`: Print a verbose lookup description.
|
|
333
|
+
|
|
334
|
+
### Example
|
|
335
|
+
|
|
336
|
+
```sh
|
|
337
|
+
command -V echo
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Output:
|
|
341
|
+
|
|
342
|
+
```text
|
|
343
|
+
echo is a shell builtin
|
|
344
|
+
```
|
|
345
|
+
## cp
|
|
346
|
+
|
|
347
|
+
Copy files and directories.
|
|
348
|
+
|
|
349
|
+
### Usage
|
|
350
|
+
|
|
351
|
+
```sh
|
|
352
|
+
cp [-rRv] SOURCE ... DESTINATION
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Options and forms
|
|
356
|
+
|
|
357
|
+
- `-r`, `-R`: Copy directories recursively (`-r` is translated to Bun Shell's `-R`).
|
|
358
|
+
- `-v`: Request verbose output.
|
|
359
|
+
- `-n`: Accepted by Bun Shell but currently does not prevent overwriting.
|
|
360
|
+
|
|
361
|
+
### Example
|
|
362
|
+
|
|
363
|
+
```sh
|
|
364
|
+
cp source.txt copy.txt
|
|
365
|
+
cat copy.txt
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
Output:
|
|
369
|
+
|
|
370
|
+
```text
|
|
371
|
+
hello
|
|
372
|
+
```
|
|
373
|
+
## cut
|
|
374
|
+
|
|
375
|
+
Select character positions.
|
|
376
|
+
|
|
377
|
+
### Usage
|
|
378
|
+
|
|
379
|
+
```sh
|
|
380
|
+
cut -c LIST [FILE ...]
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### Options and forms
|
|
384
|
+
|
|
385
|
+
- `-c LIST`, `-cLIST`: Select character positions or ranges such as `1-3,7`.
|
|
386
|
+
|
|
387
|
+
### Example
|
|
388
|
+
|
|
389
|
+
```sh
|
|
390
|
+
printf 'abcdef\n' | cut -c2-4
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
Output:
|
|
394
|
+
|
|
395
|
+
```text
|
|
396
|
+
bcd
|
|
397
|
+
```
|
|
398
|
+
## date
|
|
399
|
+
|
|
400
|
+
Print the current date.
|
|
401
|
+
|
|
402
|
+
### Usage
|
|
403
|
+
|
|
404
|
+
```sh
|
|
405
|
+
date [+FORMAT]
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Options and forms
|
|
409
|
+
|
|
410
|
+
- Formats include `%Y` year, `%m` month, `%d` day, `%H` hour, `%M` minute, `%S` second, `%s` Unix time, `%F` date, `%T` time, and `%%` percent.
|
|
411
|
+
|
|
412
|
+
### Example
|
|
413
|
+
|
|
414
|
+
```sh
|
|
415
|
+
date +%F
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Output:
|
|
419
|
+
|
|
420
|
+
```text
|
|
421
|
+
2026-08-28
|
|
422
|
+
```
|
|
423
|
+
## dirname
|
|
424
|
+
|
|
425
|
+
Print a path's directory component.
|
|
426
|
+
|
|
427
|
+
### Usage
|
|
428
|
+
|
|
429
|
+
```sh
|
|
430
|
+
dirname [--] STRING
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Options and forms
|
|
434
|
+
|
|
435
|
+
- `--`: Stop option parsing, allowing a string beginning with `-`.
|
|
436
|
+
|
|
437
|
+
### Example
|
|
438
|
+
|
|
439
|
+
```sh
|
|
440
|
+
dirname /usr/local/bin/bun
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
Output:
|
|
444
|
+
|
|
445
|
+
```text
|
|
446
|
+
/usr/local/bin
|
|
447
|
+
```
|
|
448
|
+
## echo
|
|
449
|
+
|
|
450
|
+
Write space-separated arguments.
|
|
451
|
+
|
|
452
|
+
### Usage
|
|
453
|
+
|
|
454
|
+
```sh
|
|
455
|
+
echo [-n] [ARG ...]
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Options and forms
|
|
459
|
+
|
|
460
|
+
- `-n`: Omit the trailing newline.
|
|
461
|
+
|
|
462
|
+
### Example
|
|
463
|
+
|
|
464
|
+
```sh
|
|
465
|
+
echo hello world
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
Output:
|
|
469
|
+
|
|
470
|
+
```text
|
|
471
|
+
hello world
|
|
472
|
+
```
|
|
473
|
+
## env
|
|
474
|
+
|
|
475
|
+
Print or modify the environment and optionally run a command.
|
|
476
|
+
|
|
477
|
+
### Usage
|
|
478
|
+
|
|
479
|
+
```sh
|
|
480
|
+
env [-i] [-u NAME] [NAME=VALUE ...] [COMMAND [ARG ...]]
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### Options and forms
|
|
484
|
+
|
|
485
|
+
- `-i`, `--ignore-environment`: Start with an empty environment.
|
|
486
|
+
- `-u NAME`, `--unset NAME`, `--unset=NAME`: Remove a variable.
|
|
487
|
+
- `--`: Stop option parsing.
|
|
488
|
+
|
|
489
|
+
### Example
|
|
490
|
+
|
|
491
|
+
```sh
|
|
492
|
+
env NAME=value sh -c 'echo "$NAME"'
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
Output:
|
|
496
|
+
|
|
497
|
+
```text
|
|
498
|
+
value
|
|
499
|
+
```
|
|
500
|
+
## eval
|
|
501
|
+
|
|
502
|
+
Evaluate arguments as shell source.
|
|
503
|
+
|
|
504
|
+
### Usage
|
|
505
|
+
|
|
506
|
+
```sh
|
|
507
|
+
eval [ARG ...]
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
### Example
|
|
511
|
+
|
|
512
|
+
```sh
|
|
513
|
+
code='echo evaluated'
|
|
514
|
+
eval "$code"
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
Output:
|
|
518
|
+
|
|
519
|
+
```text
|
|
520
|
+
evaluated
|
|
521
|
+
```
|
|
522
|
+
## exec
|
|
523
|
+
|
|
524
|
+
Run a command and terminate the current shell with its status.
|
|
525
|
+
|
|
526
|
+
### Usage
|
|
527
|
+
|
|
528
|
+
```sh
|
|
529
|
+
exec COMMAND [ARG ...]
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
### Example
|
|
533
|
+
|
|
534
|
+
```sh
|
|
535
|
+
exec printf 'done\n'
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
Output:
|
|
539
|
+
|
|
540
|
+
```text
|
|
541
|
+
done
|
|
542
|
+
(shell exits with status 0)
|
|
543
|
+
```
|
|
544
|
+
## exit
|
|
545
|
+
|
|
546
|
+
Exit the current shell.
|
|
547
|
+
|
|
548
|
+
### Usage
|
|
549
|
+
|
|
550
|
+
```sh
|
|
551
|
+
exit [STATUS]
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### Example
|
|
555
|
+
|
|
556
|
+
```sh
|
|
557
|
+
exit 7
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
Output:
|
|
561
|
+
|
|
562
|
+
```text
|
|
563
|
+
(shell exits with status 7)
|
|
564
|
+
```
|
|
565
|
+
## export
|
|
566
|
+
|
|
567
|
+
Set or list environment variables.
|
|
568
|
+
|
|
569
|
+
### Usage
|
|
570
|
+
|
|
571
|
+
```sh
|
|
572
|
+
export [NAME[=VALUE] ...]
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### Example
|
|
576
|
+
|
|
577
|
+
```sh
|
|
578
|
+
export NAME=value
|
|
579
|
+
env | grep '^NAME='
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
Output:
|
|
583
|
+
|
|
584
|
+
```text
|
|
585
|
+
NAME=value
|
|
586
|
+
```
|
|
587
|
+
## false
|
|
588
|
+
|
|
589
|
+
Return failure.
|
|
590
|
+
|
|
591
|
+
### Usage
|
|
592
|
+
|
|
593
|
+
```sh
|
|
594
|
+
false
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### Example
|
|
598
|
+
|
|
599
|
+
```sh
|
|
600
|
+
false
|
|
601
|
+
echo $?
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
Output:
|
|
605
|
+
|
|
606
|
+
```text
|
|
607
|
+
1
|
|
608
|
+
```
|
|
609
|
+
## find
|
|
610
|
+
|
|
611
|
+
Walk paths with name, path, type, depth, print, and -exec expressions.
|
|
612
|
+
|
|
613
|
+
### Usage
|
|
614
|
+
|
|
615
|
+
```sh
|
|
616
|
+
find [PATH ...] [EXPRESSION]
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
### Options and forms
|
|
620
|
+
|
|
621
|
+
- `-name`, `-iname`: Match a basename, optionally ignoring case.
|
|
622
|
+
- `-path`, `-ipath`: Match a path, optionally ignoring case.
|
|
623
|
+
- `-type f|d|l`: Select files, directories, or links.
|
|
624
|
+
- `-mindepth N`, `-maxdepth N`: Limit traversal depth.
|
|
625
|
+
- `-print`, `-print0`: Emit newline- or NUL-delimited paths.
|
|
626
|
+
- `!`, `-not`: Negate the following expression.
|
|
627
|
+
- `-exec COMMAND {} \;`: Run once per path.
|
|
628
|
+
- `-exec COMMAND {} +`: Run with batches of paths.
|
|
629
|
+
|
|
630
|
+
### Example
|
|
631
|
+
|
|
632
|
+
```sh
|
|
633
|
+
find . -type f -name '*.md'
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
Output:
|
|
637
|
+
|
|
638
|
+
```text
|
|
639
|
+
./README.md
|
|
640
|
+
./CHANGELOG.md
|
|
641
|
+
```
|
|
642
|
+
## getopts
|
|
643
|
+
|
|
644
|
+
Parse positional options.
|
|
645
|
+
|
|
646
|
+
### Usage
|
|
647
|
+
|
|
648
|
+
```sh
|
|
649
|
+
getopts OPTSTRING NAME [ARG ...]
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
### Options and forms
|
|
653
|
+
|
|
654
|
+
- A leading `:` in OPTSTRING selects silent error reporting.
|
|
655
|
+
- A letter followed by `:` requires an argument. Results use the named variable plus `OPTARG` and `OPTIND`.
|
|
656
|
+
|
|
657
|
+
### Example
|
|
658
|
+
|
|
659
|
+
```sh
|
|
660
|
+
set -- -a value
|
|
661
|
+
getopts a: option
|
|
662
|
+
echo "$option=$OPTARG"
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
Output:
|
|
666
|
+
|
|
667
|
+
```text
|
|
668
|
+
a=value
|
|
669
|
+
```
|
|
670
|
+
## grep
|
|
671
|
+
|
|
672
|
+
Search text with basic, extended, fixed, recursive, and color modes.
|
|
673
|
+
|
|
674
|
+
### Usage
|
|
675
|
+
|
|
676
|
+
```sh
|
|
677
|
+
grep [OPTIONS] PATTERN [FILE ...]
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
### Options and forms
|
|
681
|
+
|
|
682
|
+
- `-E`: Extended regular expressions.
|
|
683
|
+
- `-F`: Fixed-string matching.
|
|
684
|
+
- `-i`: Ignore case.
|
|
685
|
+
- `-q`: Quiet; return status only.
|
|
686
|
+
- `-v`: Invert matches.
|
|
687
|
+
- `-n`: Prefix line numbers.
|
|
688
|
+
- `-o`: Print only matched text.
|
|
689
|
+
- `-r`: Recurse into directories.
|
|
690
|
+
- `-x`: Match whole lines.
|
|
691
|
+
- `--color=always|auto|never`: Control match color; `--colour` is also accepted.
|
|
692
|
+
|
|
693
|
+
### Example
|
|
694
|
+
|
|
695
|
+
```sh
|
|
696
|
+
printf 'alpha\nbeta\n' | grep beta
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
Output:
|
|
700
|
+
|
|
701
|
+
```text
|
|
702
|
+
beta
|
|
703
|
+
```
|
|
704
|
+
## head
|
|
705
|
+
|
|
706
|
+
Write the first lines or bytes of input.
|
|
707
|
+
|
|
708
|
+
### Usage
|
|
709
|
+
|
|
710
|
+
```sh
|
|
711
|
+
head [-n N | -N | -c N | -cN] [FILE ...]
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
### Options and forms
|
|
715
|
+
|
|
716
|
+
- `-n N`, `-N`: Write the first N lines.
|
|
717
|
+
- `-c N`, `-cN`: Write the first N bytes.
|
|
718
|
+
|
|
719
|
+
### Example
|
|
720
|
+
|
|
721
|
+
```sh
|
|
722
|
+
printf 'one\ntwo\nthree\n' | head -n 2
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
Output:
|
|
726
|
+
|
|
727
|
+
```text
|
|
728
|
+
one
|
|
729
|
+
two
|
|
730
|
+
```
|
|
731
|
+
## kill
|
|
732
|
+
|
|
733
|
+
Send a signal to processes.
|
|
734
|
+
|
|
735
|
+
### Usage
|
|
736
|
+
|
|
737
|
+
```sh
|
|
738
|
+
kill [-SIGNAL] PID ...
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
### Options and forms
|
|
742
|
+
|
|
743
|
+
- `-SIGNAL`: Select a signal by name or number; the default is SIGTERM.
|
|
744
|
+
- `-0`: Check whether a process can be signalled without sending a signal.
|
|
745
|
+
|
|
746
|
+
### Example
|
|
747
|
+
|
|
748
|
+
```sh
|
|
749
|
+
kill -0 $$
|
|
750
|
+
echo $?
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
Output:
|
|
754
|
+
|
|
755
|
+
```text
|
|
756
|
+
0
|
|
757
|
+
```
|
|
758
|
+
## ln
|
|
759
|
+
|
|
760
|
+
Create hard or symbolic links.
|
|
761
|
+
|
|
762
|
+
### Usage
|
|
763
|
+
|
|
764
|
+
```sh
|
|
765
|
+
ln [-sfT] TARGET LINK
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
### Options and forms
|
|
769
|
+
|
|
770
|
+
- `-s`: Create a symbolic link.
|
|
771
|
+
- `-f`: Replace an existing destination.
|
|
772
|
+
- `-T`: Treat the destination as a normal path, not a directory.
|
|
773
|
+
|
|
774
|
+
### Example
|
|
775
|
+
|
|
776
|
+
```sh
|
|
777
|
+
ln -s target.txt link.txt
|
|
778
|
+
readlink link.txt
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
Output:
|
|
782
|
+
|
|
783
|
+
```text
|
|
784
|
+
target.txt
|
|
785
|
+
```
|
|
786
|
+
## ls
|
|
787
|
+
|
|
788
|
+
Use the lsfancy emoji and terminal-width-aware listing.
|
|
789
|
+
|
|
790
|
+
### Usage
|
|
791
|
+
|
|
792
|
+
```sh
|
|
793
|
+
ls [-aAdlhRtrS1F] [PATH ...]
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
Because `-h` means human-readable sizes, use `--help` to display this page.
|
|
797
|
+
|
|
798
|
+
### Options and forms
|
|
799
|
+
|
|
800
|
+
- `-a`: Include `.` and `..` plus hidden entries.
|
|
801
|
+
- `-A`: Include hidden entries except `.` and `..`.
|
|
802
|
+
- `-d`: List directories themselves rather than their contents.
|
|
803
|
+
- `-l`: Use long format.
|
|
804
|
+
- `-h`: Show human-readable sizes; use `--help` for this page.
|
|
805
|
+
- `-R`: Recurse into directories.
|
|
806
|
+
- `-t`: Sort by modification time.
|
|
807
|
+
- `-r`: Reverse the result order.
|
|
808
|
+
- `-S`: Sort by size.
|
|
809
|
+
- `-1`: Print one entry per line.
|
|
810
|
+
- `-F`: Append classify suffixes such as `/`, `@`, and `*`.
|
|
811
|
+
|
|
812
|
+
### Example
|
|
813
|
+
|
|
814
|
+
```sh
|
|
815
|
+
builtin ls -l README.md
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
Output:
|
|
819
|
+
|
|
820
|
+
```text
|
|
821
|
+
-rw-r--r-- 32221 2026-08-28 17:55 📄 README.md
|
|
822
|
+
```
|
|
823
|
+
## lsbun
|
|
824
|
+
|
|
825
|
+
Invoke Bun Shell's original ls implementation.
|
|
826
|
+
|
|
827
|
+
### Usage
|
|
828
|
+
|
|
829
|
+
```sh
|
|
830
|
+
lsbun [OPTIONS] [PATH ...]
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### Options and forms
|
|
834
|
+
|
|
835
|
+
- `-a`: Include all entries.
|
|
836
|
+
- `-A`: Include hidden entries except `.` and `..`.
|
|
837
|
+
- `-d`: List directories themselves.
|
|
838
|
+
- `-l`: Use long format.
|
|
839
|
+
- `-R`: Recurse into directories.
|
|
840
|
+
|
|
841
|
+
### Example
|
|
842
|
+
|
|
843
|
+
```sh
|
|
844
|
+
builtin lsbun README.md
|
|
845
|
+
```
|
|
846
|
+
|
|
847
|
+
Output:
|
|
848
|
+
|
|
849
|
+
```text
|
|
850
|
+
README.md
|
|
851
|
+
```
|
|
852
|
+
## lsfancy
|
|
853
|
+
|
|
854
|
+
List files with icons, columns, metadata, sorting, and recursion.
|
|
855
|
+
|
|
856
|
+
### Usage
|
|
857
|
+
|
|
858
|
+
```sh
|
|
859
|
+
lsfancy [-aAdlhRtrS1F] [PATH ...]
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
Because `-h` means human-readable sizes, use `--help` to display this page.
|
|
863
|
+
|
|
864
|
+
### Options and forms
|
|
865
|
+
|
|
866
|
+
- `-a`: Include `.` and `..` plus hidden entries.
|
|
867
|
+
- `-A`: Include hidden entries except `.` and `..`.
|
|
868
|
+
- `-d`: List directories themselves rather than their contents.
|
|
869
|
+
- `-l`: Use long format, including symlink targets.
|
|
870
|
+
- `-h`: Show human-readable sizes; use `--help` for this page.
|
|
871
|
+
- `-R`: Recurse into directories.
|
|
872
|
+
- `-t`: Sort by modification time.
|
|
873
|
+
- `-r`: Reverse the result order.
|
|
874
|
+
- `-S`: Sort by size.
|
|
875
|
+
- `-1`: Print one entry per line.
|
|
876
|
+
- `-F`: Append `/` for directories, `@` for links, `*` for executables, `=` for sockets, or `|` for FIFOs.
|
|
877
|
+
|
|
878
|
+
### Example
|
|
879
|
+
|
|
880
|
+
```sh
|
|
881
|
+
builtin lsfancy -1 README.md
|
|
882
|
+
```
|
|
883
|
+
|
|
884
|
+
Output:
|
|
885
|
+
|
|
886
|
+
```text
|
|
887
|
+
📄 README.md
|
|
888
|
+
```
|
|
889
|
+
## md5sum
|
|
890
|
+
|
|
891
|
+
Print MD5 hashes.
|
|
892
|
+
|
|
893
|
+
### Usage
|
|
894
|
+
|
|
895
|
+
```sh
|
|
896
|
+
md5sum [FILE ...]
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
### Example
|
|
900
|
+
|
|
901
|
+
```sh
|
|
902
|
+
printf hello | md5sum
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
Output:
|
|
906
|
+
|
|
907
|
+
```text
|
|
908
|
+
5d41402abc4b2a76b9719d911017c592 -
|
|
909
|
+
```
|
|
910
|
+
## mkdir
|
|
911
|
+
|
|
912
|
+
Create directories with Bun Shell's fallback.
|
|
913
|
+
|
|
914
|
+
### Usage
|
|
915
|
+
|
|
916
|
+
```sh
|
|
917
|
+
mkdir [-pv] [--parents] DIRECTORY ...
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
### Options and forms
|
|
921
|
+
|
|
922
|
+
- `-p`, `--parents`: Create missing parent directories and accept existing directories.
|
|
923
|
+
- `-v`, `--vebose`: Request verbose output (`--vebose` is Bun Shell's currently accepted spelling).
|
|
924
|
+
|
|
925
|
+
### Example
|
|
926
|
+
|
|
927
|
+
```sh
|
|
928
|
+
mkdir -p build/output
|
|
929
|
+
builtin test -d build/output; echo $?
|
|
930
|
+
```
|
|
931
|
+
|
|
932
|
+
Output:
|
|
933
|
+
|
|
934
|
+
```text
|
|
935
|
+
0
|
|
936
|
+
```
|
|
937
|
+
## mktemp
|
|
938
|
+
|
|
939
|
+
Create a temporary file or directory; TEMPLATE ends in XXXXXX.
|
|
940
|
+
|
|
941
|
+
### Usage
|
|
942
|
+
|
|
943
|
+
```sh
|
|
944
|
+
mktemp [-d] TEMPLATE
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
### Options and forms
|
|
948
|
+
|
|
949
|
+
- `-d`: Create a directory instead of a file.
|
|
950
|
+
- The template must end in exactly six `X` characters.
|
|
951
|
+
|
|
952
|
+
### Example
|
|
953
|
+
|
|
954
|
+
```sh
|
|
955
|
+
mktemp sample.XXXXXX
|
|
956
|
+
```
|
|
957
|
+
|
|
958
|
+
Output:
|
|
959
|
+
|
|
960
|
+
```text
|
|
961
|
+
sample.a1B2c3
|
|
962
|
+
```
|
|
963
|
+
## mv
|
|
964
|
+
|
|
965
|
+
Move files with Bun Shell's fallback.
|
|
966
|
+
|
|
967
|
+
### Usage
|
|
968
|
+
|
|
969
|
+
```sh
|
|
970
|
+
mv [OPTIONS] SOURCE ... DESTINATION
|
|
971
|
+
```
|
|
972
|
+
|
|
973
|
+
### Options and forms
|
|
974
|
+
|
|
975
|
+
- `-f`, `-h`, `-i`, `-n`, `-v`: Currently accepted by Bun Shell but do not change behaviour; `-i` and `-n` do not prevent overwriting.
|
|
976
|
+
|
|
977
|
+
### Example
|
|
978
|
+
|
|
979
|
+
```sh
|
|
980
|
+
mv old.txt new.txt
|
|
981
|
+
basename new.txt
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
Output:
|
|
985
|
+
|
|
986
|
+
```text
|
|
987
|
+
new.txt
|
|
988
|
+
```
|
|
989
|
+
## print
|
|
990
|
+
|
|
991
|
+
Write arguments with mksh-style print semantics.
|
|
992
|
+
|
|
993
|
+
### Usage
|
|
994
|
+
|
|
995
|
+
```sh
|
|
996
|
+
print [-rRnNl] [-uFD] [--] [ARG ...]
|
|
997
|
+
```
|
|
998
|
+
|
|
999
|
+
### Options and forms
|
|
1000
|
+
|
|
1001
|
+
- `-r`, `-R`: Do not interpret backslash escapes.
|
|
1002
|
+
- `-n`: Omit the terminator.
|
|
1003
|
+
- `-l`: Separate arguments with newlines.
|
|
1004
|
+
- `-N`: Separate and terminate arguments with NUL bytes.
|
|
1005
|
+
- `-uFD`: Write to file descriptor 1 or 2; other descriptors are not implemented.
|
|
1006
|
+
- `--`: Stop option parsing.
|
|
1007
|
+
|
|
1008
|
+
### Example
|
|
1009
|
+
|
|
1010
|
+
```sh
|
|
1011
|
+
print hello world
|
|
1012
|
+
```
|
|
1013
|
+
|
|
1014
|
+
Output:
|
|
1015
|
+
|
|
1016
|
+
```text
|
|
1017
|
+
hello world
|
|
1018
|
+
```
|
|
1019
|
+
## printf
|
|
1020
|
+
|
|
1021
|
+
Format and write arguments.
|
|
1022
|
+
|
|
1023
|
+
### Usage
|
|
1024
|
+
|
|
1025
|
+
```sh
|
|
1026
|
+
printf FORMAT [ARG ...]
|
|
1027
|
+
```
|
|
1028
|
+
|
|
1029
|
+
### Options and forms
|
|
1030
|
+
|
|
1031
|
+
- Supported conversions are `%s`, `%d`, `%i`, `%%`, and optional numeric field widths; backslash escapes are also interpreted.
|
|
1032
|
+
|
|
1033
|
+
### Example
|
|
1034
|
+
|
|
1035
|
+
```sh
|
|
1036
|
+
printf '%s=%d\n' answer 42
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
Output:
|
|
1040
|
+
|
|
1041
|
+
```text
|
|
1042
|
+
answer=42
|
|
1043
|
+
```
|
|
1044
|
+
## pwd
|
|
1045
|
+
|
|
1046
|
+
Print the active directory.
|
|
1047
|
+
|
|
1048
|
+
### Usage
|
|
1049
|
+
|
|
1050
|
+
```sh
|
|
1051
|
+
pwd
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
### Example
|
|
1055
|
+
|
|
1056
|
+
```sh
|
|
1057
|
+
pwd
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
Output:
|
|
1061
|
+
|
|
1062
|
+
```text
|
|
1063
|
+
/data/data/com.termux/files/home
|
|
1064
|
+
```
|
|
1065
|
+
## read
|
|
1066
|
+
|
|
1067
|
+
Read a line into shell variables.
|
|
1068
|
+
|
|
1069
|
+
### Usage
|
|
1070
|
+
|
|
1071
|
+
```sh
|
|
1072
|
+
read [-r] NAME ...
|
|
1073
|
+
```
|
|
1074
|
+
|
|
1075
|
+
### Options and forms
|
|
1076
|
+
|
|
1077
|
+
- `-r`: Preserve backslashes instead of treating them as escapes.
|
|
1078
|
+
- `--`: Stop option parsing. With no names, assign to `REPLY`.
|
|
1079
|
+
|
|
1080
|
+
### Example
|
|
1081
|
+
|
|
1082
|
+
```sh
|
|
1083
|
+
printf 'one two\n' | read first second
|
|
1084
|
+
echo "$first/$second"
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
Output:
|
|
1088
|
+
|
|
1089
|
+
```text
|
|
1090
|
+
one/two
|
|
1091
|
+
```
|
|
1092
|
+
## readonly
|
|
1093
|
+
|
|
1094
|
+
Define variables that cannot be changed.
|
|
1095
|
+
|
|
1096
|
+
### Usage
|
|
1097
|
+
|
|
1098
|
+
```sh
|
|
1099
|
+
readonly [-p] [--] [NAME[=VALUE] ...]
|
|
1100
|
+
```
|
|
1101
|
+
|
|
1102
|
+
### Options and forms
|
|
1103
|
+
|
|
1104
|
+
- `-p`: Print readonly definitions.
|
|
1105
|
+
- `--`: Stop option parsing.
|
|
1106
|
+
|
|
1107
|
+
### Example
|
|
1108
|
+
|
|
1109
|
+
```sh
|
|
1110
|
+
readonly NAME=value
|
|
1111
|
+
echo "$NAME"
|
|
1112
|
+
```
|
|
1113
|
+
|
|
1114
|
+
Output:
|
|
1115
|
+
|
|
1116
|
+
```text
|
|
1117
|
+
value
|
|
1118
|
+
```
|
|
1119
|
+
## realpath
|
|
1120
|
+
|
|
1121
|
+
Print canonical absolute paths.
|
|
1122
|
+
|
|
1123
|
+
### Usage
|
|
1124
|
+
|
|
1125
|
+
```sh
|
|
1126
|
+
realpath PATH ...
|
|
1127
|
+
```
|
|
1128
|
+
|
|
1129
|
+
### Example
|
|
1130
|
+
|
|
1131
|
+
```sh
|
|
1132
|
+
realpath .
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
Output:
|
|
1136
|
+
|
|
1137
|
+
```text
|
|
1138
|
+
/data/data/com.termux/files/home/bunmsh
|
|
1139
|
+
```
|
|
1140
|
+
## rm
|
|
1141
|
+
|
|
1142
|
+
Remove files and directories with Bun Shell's fallback.
|
|
1143
|
+
|
|
1144
|
+
### Usage
|
|
1145
|
+
|
|
1146
|
+
```sh
|
|
1147
|
+
rm [OPTIONS] FILE ...
|
|
1148
|
+
```
|
|
1149
|
+
|
|
1150
|
+
### Options and forms
|
|
1151
|
+
|
|
1152
|
+
- `-f`: Ignore missing operands.
|
|
1153
|
+
- `-r`, `-R`, `--recursive`: Remove directories recursively.
|
|
1154
|
+
- `-v`, `--verbose`: Request verbose output.
|
|
1155
|
+
- `-d`, `--dir`: Remove empty directories.
|
|
1156
|
+
- `-i`, `--interactive=always`: Prompt for each removal.
|
|
1157
|
+
- `-I`, `--interactive=once`: Prompt once.
|
|
1158
|
+
- `--interactive=never`: Never prompt.
|
|
1159
|
+
- `--preserve-root`, `--no-preserve-root`: Accepted but currently have no effect.
|
|
1160
|
+
|
|
1161
|
+
### Example
|
|
1162
|
+
|
|
1163
|
+
```sh
|
|
1164
|
+
rm unwanted.txt
|
|
1165
|
+
builtin test -e unwanted.txt; echo $?
|
|
1166
|
+
```
|
|
1167
|
+
|
|
1168
|
+
Output:
|
|
1169
|
+
|
|
1170
|
+
```text
|
|
1171
|
+
1
|
|
1172
|
+
```
|
|
1173
|
+
## rmdir
|
|
1174
|
+
|
|
1175
|
+
Remove empty directories.
|
|
1176
|
+
|
|
1177
|
+
### Usage
|
|
1178
|
+
|
|
1179
|
+
```sh
|
|
1180
|
+
rmdir [-p | --parents] DIRECTORY ...
|
|
1181
|
+
```
|
|
1182
|
+
|
|
1183
|
+
### Options and forms
|
|
1184
|
+
|
|
1185
|
+
- `-p`, `--parents`: Remove empty parent directories after each operand.
|
|
1186
|
+
|
|
1187
|
+
### Example
|
|
1188
|
+
|
|
1189
|
+
```sh
|
|
1190
|
+
mkdir empty
|
|
1191
|
+
rmdir empty
|
|
1192
|
+
builtin test -d empty; echo $?
|
|
1193
|
+
```
|
|
1194
|
+
|
|
1195
|
+
Output:
|
|
1196
|
+
|
|
1197
|
+
```text
|
|
1198
|
+
1
|
|
1199
|
+
```
|
|
1200
|
+
## sed
|
|
1201
|
+
|
|
1202
|
+
Apply supported print and substitution expressions.
|
|
1203
|
+
|
|
1204
|
+
### Usage
|
|
1205
|
+
|
|
1206
|
+
```sh
|
|
1207
|
+
sed [-nEr] [-e SCRIPT] [-i] [SCRIPT] [FILE ...]
|
|
1208
|
+
```
|
|
1209
|
+
|
|
1210
|
+
### Options and forms
|
|
1211
|
+
|
|
1212
|
+
- `-n`: Suppress automatic output.
|
|
1213
|
+
- `-e SCRIPT`, `-eSCRIPT`: Add a script.
|
|
1214
|
+
- `-E`, `-r`: Use extended regular expressions.
|
|
1215
|
+
- `-i`: Edit files in place.
|
|
1216
|
+
- Supported commands include numeric `p` and `s///` with `g` and `p` flags.
|
|
1217
|
+
|
|
1218
|
+
### Example
|
|
1219
|
+
|
|
1220
|
+
```sh
|
|
1221
|
+
printf 'hello world\n' | sed 's/world/bunmsh/'
|
|
1222
|
+
```
|
|
1223
|
+
|
|
1224
|
+
Output:
|
|
1225
|
+
|
|
1226
|
+
```text
|
|
1227
|
+
hello bunmsh
|
|
1228
|
+
```
|
|
1229
|
+
## seq
|
|
1230
|
+
|
|
1231
|
+
Print a numeric sequence.
|
|
1232
|
+
|
|
1233
|
+
### Usage
|
|
1234
|
+
|
|
1235
|
+
```sh
|
|
1236
|
+
seq [OPTIONS] [FIRST [INCREMENT]] LAST
|
|
1237
|
+
```
|
|
1238
|
+
|
|
1239
|
+
### Options and forms
|
|
1240
|
+
|
|
1241
|
+
- `-s TEXT`, `--separator TEXT`: Set the separator.
|
|
1242
|
+
- `-t TEXT`, `--terminator TEXT`: Set the terminator.
|
|
1243
|
+
- `-w`, `--fixed-width`: Accepted, but currently does not pad values.
|
|
1244
|
+
|
|
1245
|
+
### Example
|
|
1246
|
+
|
|
1247
|
+
```sh
|
|
1248
|
+
seq 3
|
|
1249
|
+
```
|
|
1250
|
+
|
|
1251
|
+
Output:
|
|
1252
|
+
|
|
1253
|
+
```text
|
|
1254
|
+
1
|
|
1255
|
+
2
|
|
1256
|
+
3
|
|
1257
|
+
```
|
|
1258
|
+
## serve
|
|
1259
|
+
|
|
1260
|
+
Start the bunmsh HTTP file server.
|
|
1261
|
+
|
|
1262
|
+
### Usage
|
|
1263
|
+
|
|
1264
|
+
```sh
|
|
1265
|
+
serve [--auto-open] [--minapk-webview] [--random-url] [DIRECTORY]
|
|
1266
|
+
```
|
|
1267
|
+
|
|
1268
|
+
### Options and forms
|
|
1269
|
+
|
|
1270
|
+
- `--auto-open` / `--auto-open=off` / `--auto-open=/path`: Open the serving
|
|
1271
|
+
URL after startup, or explicitly disable it, or open a specific path under
|
|
1272
|
+
it instead of the root. Looks for `xdg-open` on PATH first regardless of
|
|
1273
|
+
platform; falls back to `open` on macOS or `cmd /c start` on Windows only
|
|
1274
|
+
when `xdg-open` isn't found. Bare `--auto-open` turns it on; `=off`, `=no`,
|
|
1275
|
+
`=false`, or `=` (empty) turns it off, overriding an environment default
|
|
1276
|
+
that turned it on; a value starting with `/` (e.g. `--auto-open=/index.html`)
|
|
1277
|
+
turns it on and opens that path relative to the served URL instead of the
|
|
1278
|
+
root — resolved after any `--random-url` prefix, so the secret prefix is
|
|
1279
|
+
still there and the URL still works. The `o` control on stdin (see below)
|
|
1280
|
+
opens the same target this flag configured.
|
|
1281
|
+
- `--minapk-webview` / `--minapk-webview=N` / `--minapk-webview=off`: Pass
|
|
1282
|
+
`MINAPK_WEBVIEW` to the spawned opener. Bare `--minapk-webview` passes `1`;
|
|
1283
|
+
`=N` passes the literal digit string `N`; `=off`, `=no`, `=false`, or `=`
|
|
1284
|
+
(empty) means don't pass it at all. Not passed by default.
|
|
1285
|
+
- `--random-url` / `--random-url=off`: Serve beneath a high-entropy random URL
|
|
1286
|
+
prefix (requests without it get `404`), or explicitly disable it. Same
|
|
1287
|
+
bare/`=off`/`=no`/`=false`/`=` rules as `--auto-open`.
|
|
1288
|
+
- `SERVE_AUTO_OPEN`, `SERVE_MINAPK_WEBVIEW`, and `SERVE_RANDOM_URL` set the
|
|
1289
|
+
defaults before CLI flags are applied (accepting `1`, `true`, `yes`, or
|
|
1290
|
+
`on`; a digit string for `SERVE_MINAPK_WEBVIEW`; a `/`-led path for
|
|
1291
|
+
`SERVE_AUTO_OPEN`); every flag defaults to off/not-passed. A CLI flag
|
|
1292
|
+
always overrides its environment default, including turning off something
|
|
1293
|
+
the environment turned on.
|
|
1294
|
+
- `--` stops option parsing. The optional operand selects the served directory.
|
|
1295
|
+
|
|
1296
|
+
### Example
|
|
1297
|
+
|
|
1298
|
+
```sh
|
|
1299
|
+
serve --random-url public
|
|
1300
|
+
```
|
|
1301
|
+
|
|
1302
|
+
Output:
|
|
1303
|
+
|
|
1304
|
+
```text
|
|
1305
|
+
Serving /home/user/public
|
|
1306
|
+
http://localhost:3000/AaBIdviNcACxwZF2x3VW0QAaBIdviNcAGsAviNI5B59AAaBIdviNcAKsuNiSJkMrdQAaBIdviNcAOoVDLS5ydB9Q/
|
|
1307
|
+
```
|
|
1308
|
+
## set
|
|
1309
|
+
|
|
1310
|
+
Print variables or replace positional parameters.
|
|
1311
|
+
|
|
1312
|
+
### Usage
|
|
1313
|
+
|
|
1314
|
+
```sh
|
|
1315
|
+
set [-- [ARG ...]]
|
|
1316
|
+
```
|
|
1317
|
+
|
|
1318
|
+
### Options and forms
|
|
1319
|
+
|
|
1320
|
+
- `--`: Replace positional parameters with the remaining arguments. With no arguments, print variables.
|
|
1321
|
+
|
|
1322
|
+
### Example
|
|
1323
|
+
|
|
1324
|
+
```sh
|
|
1325
|
+
set -- alpha beta
|
|
1326
|
+
echo "$1/$2"
|
|
1327
|
+
```
|
|
1328
|
+
|
|
1329
|
+
Output:
|
|
1330
|
+
|
|
1331
|
+
```text
|
|
1332
|
+
alpha/beta
|
|
1333
|
+
```
|
|
1334
|
+
## sha256sum
|
|
1335
|
+
|
|
1336
|
+
Print SHA-256 hashes.
|
|
1337
|
+
|
|
1338
|
+
### Usage
|
|
1339
|
+
|
|
1340
|
+
```sh
|
|
1341
|
+
sha256sum [FILE ...]
|
|
1342
|
+
```
|
|
1343
|
+
|
|
1344
|
+
### Example
|
|
1345
|
+
|
|
1346
|
+
```sh
|
|
1347
|
+
printf hello | sha256sum
|
|
1348
|
+
```
|
|
1349
|
+
|
|
1350
|
+
Output:
|
|
1351
|
+
|
|
1352
|
+
```text
|
|
1353
|
+
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 -
|
|
1354
|
+
```
|
|
1355
|
+
## shift
|
|
1356
|
+
|
|
1357
|
+
Discard leading positional parameters.
|
|
1358
|
+
|
|
1359
|
+
### Usage
|
|
1360
|
+
|
|
1361
|
+
```sh
|
|
1362
|
+
shift [COUNT]
|
|
1363
|
+
```
|
|
1364
|
+
|
|
1365
|
+
### Example
|
|
1366
|
+
|
|
1367
|
+
```sh
|
|
1368
|
+
set -- one two three
|
|
1369
|
+
shift
|
|
1370
|
+
echo "$1 $2"
|
|
1371
|
+
```
|
|
1372
|
+
|
|
1373
|
+
Output:
|
|
1374
|
+
|
|
1375
|
+
```text
|
|
1376
|
+
two three
|
|
1377
|
+
```
|
|
1378
|
+
## sleep
|
|
1379
|
+
|
|
1380
|
+
Pause; supports ms, s, m, and h suffixes.
|
|
1381
|
+
|
|
1382
|
+
### Usage
|
|
1383
|
+
|
|
1384
|
+
```sh
|
|
1385
|
+
sleep DURATION
|
|
1386
|
+
```
|
|
1387
|
+
|
|
1388
|
+
### Options and forms
|
|
1389
|
+
|
|
1390
|
+
- Bare durations are seconds; suffixes `ms`, `s`, `m`, and `h` select milliseconds, seconds, minutes, and hours.
|
|
1391
|
+
|
|
1392
|
+
### Example
|
|
1393
|
+
|
|
1394
|
+
```sh
|
|
1395
|
+
time sleep 10ms
|
|
1396
|
+
```
|
|
1397
|
+
|
|
1398
|
+
Output:
|
|
1399
|
+
|
|
1400
|
+
```text
|
|
1401
|
+
real 10.000000 ms
|
|
1402
|
+
```
|
|
1403
|
+
## sort
|
|
1404
|
+
|
|
1405
|
+
Sort, reverse, compare numerically, or deduplicate lines.
|
|
1406
|
+
|
|
1407
|
+
### Usage
|
|
1408
|
+
|
|
1409
|
+
```sh
|
|
1410
|
+
sort [-rnu] [FILE ...]
|
|
1411
|
+
```
|
|
1412
|
+
|
|
1413
|
+
### Options and forms
|
|
1414
|
+
|
|
1415
|
+
- `-r`: Reverse the result.
|
|
1416
|
+
- `-n`: Compare numerically.
|
|
1417
|
+
- `-u`: Remove duplicate lines. These short flags may be combined.
|
|
1418
|
+
|
|
1419
|
+
### Example
|
|
1420
|
+
|
|
1421
|
+
```sh
|
|
1422
|
+
printf 'c\na\nb\n' | sort
|
|
1423
|
+
```
|
|
1424
|
+
|
|
1425
|
+
Output:
|
|
1426
|
+
|
|
1427
|
+
```text
|
|
1428
|
+
a
|
|
1429
|
+
b
|
|
1430
|
+
c
|
|
1431
|
+
```
|
|
1432
|
+
## source
|
|
1433
|
+
|
|
1434
|
+
Evaluate a file in the current shell.
|
|
1435
|
+
|
|
1436
|
+
### Usage
|
|
1437
|
+
|
|
1438
|
+
```sh
|
|
1439
|
+
source FILE [ARG ...]
|
|
1440
|
+
```
|
|
1441
|
+
|
|
1442
|
+
### Example
|
|
1443
|
+
|
|
1444
|
+
```sh
|
|
1445
|
+
printf 'NAME=sourced\n' > settings.sh
|
|
1446
|
+
source settings.sh
|
|
1447
|
+
echo "$NAME"
|
|
1448
|
+
```
|
|
1449
|
+
|
|
1450
|
+
Output:
|
|
1451
|
+
|
|
1452
|
+
```text
|
|
1453
|
+
sourced
|
|
1454
|
+
```
|
|
1455
|
+
## tab
|
|
1456
|
+
|
|
1457
|
+
Manage directory tabs and shell session controls.
|
|
1458
|
+
|
|
1459
|
+
### Usage
|
|
1460
|
+
|
|
1461
|
+
```sh
|
|
1462
|
+
tab [n | x | c | l | r | s | save | path | mouse | NUMBER]
|
|
1463
|
+
```
|
|
1464
|
+
|
|
1465
|
+
### Options and forms
|
|
1466
|
+
|
|
1467
|
+
- `n` creates a tab; `x`/`c` closes it; `l` and `r` switch tabs.
|
|
1468
|
+
- `save`/`s` saves history; `save d` deduplicates it.
|
|
1469
|
+
- `path [on|off|true|false]` controls PATH lookup.
|
|
1470
|
+
- `mouse [on|off|true|false]` controls terminal mouse tracking.
|
|
1471
|
+
- A numeric operand selects that tab.
|
|
1472
|
+
|
|
1473
|
+
### Example
|
|
1474
|
+
|
|
1475
|
+
```sh
|
|
1476
|
+
tab
|
|
1477
|
+
```
|
|
1478
|
+
|
|
1479
|
+
Output:
|
|
1480
|
+
|
|
1481
|
+
```text
|
|
1482
|
+
📁 ~/project 📂 ~/project
|
|
1483
|
+
[2]$
|
|
1484
|
+
```
|
|
1485
|
+
## tac
|
|
1486
|
+
|
|
1487
|
+
Reverse newline-delimited records in each input file.
|
|
1488
|
+
|
|
1489
|
+
### Usage
|
|
1490
|
+
|
|
1491
|
+
```sh
|
|
1492
|
+
tac [--] [FILE ...]
|
|
1493
|
+
```
|
|
1494
|
+
|
|
1495
|
+
### Options and forms
|
|
1496
|
+
|
|
1497
|
+
- `--`: Stop option parsing.
|
|
1498
|
+
- `-`: Read from stdin at that operand position.
|
|
1499
|
+
- Other options are not currently supported.
|
|
1500
|
+
|
|
1501
|
+
### Example
|
|
1502
|
+
|
|
1503
|
+
```sh
|
|
1504
|
+
printf 'one\ntwo\nthree\n' | tac
|
|
1505
|
+
```
|
|
1506
|
+
|
|
1507
|
+
Output:
|
|
1508
|
+
|
|
1509
|
+
```text
|
|
1510
|
+
three
|
|
1511
|
+
two
|
|
1512
|
+
one
|
|
1513
|
+
```
|
|
1514
|
+
## tail
|
|
1515
|
+
|
|
1516
|
+
Write the last lines, or start output at a selected line.
|
|
1517
|
+
|
|
1518
|
+
### Usage
|
|
1519
|
+
|
|
1520
|
+
```sh
|
|
1521
|
+
tail [-n N | -N | -n +N | -n+N] [FILE ...]
|
|
1522
|
+
```
|
|
1523
|
+
|
|
1524
|
+
### Options and forms
|
|
1525
|
+
|
|
1526
|
+
- `-n N`, `-N`: Write the last N lines.
|
|
1527
|
+
- `-n +N`, `-n+N`: Start output at line N.
|
|
1528
|
+
|
|
1529
|
+
### Example
|
|
1530
|
+
|
|
1531
|
+
```sh
|
|
1532
|
+
printf 'one\ntwo\nthree\n' | tail -n 2
|
|
1533
|
+
```
|
|
1534
|
+
|
|
1535
|
+
Output:
|
|
1536
|
+
|
|
1537
|
+
```text
|
|
1538
|
+
two
|
|
1539
|
+
three
|
|
1540
|
+
```
|
|
1541
|
+
## tee
|
|
1542
|
+
|
|
1543
|
+
Copy stdin to stdout and files.
|
|
1544
|
+
|
|
1545
|
+
### Usage
|
|
1546
|
+
|
|
1547
|
+
```sh
|
|
1548
|
+
tee [-a] [FILE ...]
|
|
1549
|
+
```
|
|
1550
|
+
|
|
1551
|
+
### Options and forms
|
|
1552
|
+
|
|
1553
|
+
- `-a`: Append to files rather than replacing them.
|
|
1554
|
+
|
|
1555
|
+
### Example
|
|
1556
|
+
|
|
1557
|
+
```sh
|
|
1558
|
+
printf hello | tee output.txt
|
|
1559
|
+
```
|
|
1560
|
+
|
|
1561
|
+
Output:
|
|
1562
|
+
|
|
1563
|
+
```text
|
|
1564
|
+
hello
|
|
1565
|
+
```
|
|
1566
|
+
## test
|
|
1567
|
+
|
|
1568
|
+
Evaluate file, string, and integer expressions; [ requires a closing ].
|
|
1569
|
+
|
|
1570
|
+
### Usage
|
|
1571
|
+
|
|
1572
|
+
```sh
|
|
1573
|
+
test EXPRESSION
|
|
1574
|
+
```
|
|
1575
|
+
|
|
1576
|
+
### Options and forms
|
|
1577
|
+
|
|
1578
|
+
- Unary file tests: `-e`, `-f`, `-d`, `-b`, `-c`, `-p`, `-S`, `-L`/`-h`, `-s`, `-r`, `-w`, and `-x`.
|
|
1579
|
+
- Unary string tests: `-n` and `-z`.
|
|
1580
|
+
- String comparisons: `=`, `==`, and `!=`.
|
|
1581
|
+
- Integer comparisons: `-eq`, `-ne`, `-gt`, `-ge`, `-lt`, and `-le`.
|
|
1582
|
+
- File comparisons: `-nt`, `-ot`, and `-ef`. Logical `!`, `-a`, and `-o` are supported.
|
|
1583
|
+
|
|
1584
|
+
### Example
|
|
1585
|
+
|
|
1586
|
+
```sh
|
|
1587
|
+
test -d /tmp
|
|
1588
|
+
echo $?
|
|
1589
|
+
```
|
|
1590
|
+
|
|
1591
|
+
Output:
|
|
1592
|
+
|
|
1593
|
+
```text
|
|
1594
|
+
0
|
|
1595
|
+
```
|
|
1596
|
+
## time
|
|
1597
|
+
|
|
1598
|
+
Run a command and report elapsed time.
|
|
1599
|
+
|
|
1600
|
+
### Usage
|
|
1601
|
+
|
|
1602
|
+
```sh
|
|
1603
|
+
time [COMMAND [ARG ...]]
|
|
1604
|
+
```
|
|
1605
|
+
|
|
1606
|
+
### Display
|
|
1607
|
+
|
|
1608
|
+
- Elapsed time is written to stderr in milliseconds with six decimal places.
|
|
1609
|
+
- When stderr is a terminal, each three-digit magnitude group uses a different
|
|
1610
|
+
ANSI color, making units and fractional precision easier to distinguish.
|
|
1611
|
+
- The decimal point is dimmed. Colors are omitted when stderr is redirected or
|
|
1612
|
+
captured.
|
|
1613
|
+
|
|
1614
|
+
### Example
|
|
1615
|
+
|
|
1616
|
+
```sh
|
|
1617
|
+
time true
|
|
1618
|
+
```
|
|
1619
|
+
|
|
1620
|
+
Output:
|
|
1621
|
+
|
|
1622
|
+
```text
|
|
1623
|
+
real 0.000000 ms
|
|
1624
|
+
```
|
|
1625
|
+
## touch
|
|
1626
|
+
|
|
1627
|
+
Create files or update timestamps.
|
|
1628
|
+
|
|
1629
|
+
### Usage
|
|
1630
|
+
|
|
1631
|
+
```sh
|
|
1632
|
+
touch FILE ...
|
|
1633
|
+
```
|
|
1634
|
+
|
|
1635
|
+
### Options and forms
|
|
1636
|
+
|
|
1637
|
+
- No options are currently supported.
|
|
1638
|
+
|
|
1639
|
+
### Example
|
|
1640
|
+
|
|
1641
|
+
```sh
|
|
1642
|
+
touch created.txt
|
|
1643
|
+
builtin test -f created.txt; echo $?
|
|
1644
|
+
```
|
|
1645
|
+
|
|
1646
|
+
Output:
|
|
1647
|
+
|
|
1648
|
+
```text
|
|
1649
|
+
0
|
|
1650
|
+
```
|
|
1651
|
+
## tr
|
|
1652
|
+
|
|
1653
|
+
Translate or delete characters.
|
|
1654
|
+
|
|
1655
|
+
### Usage
|
|
1656
|
+
|
|
1657
|
+
```sh
|
|
1658
|
+
tr [-d] SET1 [SET2]
|
|
1659
|
+
```
|
|
1660
|
+
|
|
1661
|
+
### Options and forms
|
|
1662
|
+
|
|
1663
|
+
- `-d`: Delete characters in SET1 instead of translating them.
|
|
1664
|
+
- Simple ranges such as `a-z` are supported.
|
|
1665
|
+
|
|
1666
|
+
### Example
|
|
1667
|
+
|
|
1668
|
+
```sh
|
|
1669
|
+
printf 'hello\n' | tr a-z A-Z
|
|
1670
|
+
```
|
|
1671
|
+
|
|
1672
|
+
Output:
|
|
1673
|
+
|
|
1674
|
+
```text
|
|
1675
|
+
HELLO
|
|
1676
|
+
```
|
|
1677
|
+
## true
|
|
1678
|
+
|
|
1679
|
+
Return success.
|
|
1680
|
+
|
|
1681
|
+
### Usage
|
|
1682
|
+
|
|
1683
|
+
```sh
|
|
1684
|
+
true
|
|
1685
|
+
```
|
|
1686
|
+
|
|
1687
|
+
### Example
|
|
1688
|
+
|
|
1689
|
+
```sh
|
|
1690
|
+
true
|
|
1691
|
+
echo $?
|
|
1692
|
+
```
|
|
1693
|
+
|
|
1694
|
+
Output:
|
|
1695
|
+
|
|
1696
|
+
```text
|
|
1697
|
+
0
|
|
1698
|
+
```
|
|
1699
|
+
## type
|
|
1700
|
+
|
|
1701
|
+
Describe how command names resolve.
|
|
1702
|
+
|
|
1703
|
+
### Usage
|
|
1704
|
+
|
|
1705
|
+
```sh
|
|
1706
|
+
type NAME ...
|
|
1707
|
+
```
|
|
1708
|
+
|
|
1709
|
+
### Example
|
|
1710
|
+
|
|
1711
|
+
```sh
|
|
1712
|
+
type echo
|
|
1713
|
+
```
|
|
1714
|
+
|
|
1715
|
+
Output:
|
|
1716
|
+
|
|
1717
|
+
```text
|
|
1718
|
+
echo is a shell builtin
|
|
1719
|
+
```
|
|
1720
|
+
## umask
|
|
1721
|
+
|
|
1722
|
+
Print or set the file-creation mask.
|
|
1723
|
+
|
|
1724
|
+
### Usage
|
|
1725
|
+
|
|
1726
|
+
```sh
|
|
1727
|
+
umask [MODE]
|
|
1728
|
+
```
|
|
1729
|
+
|
|
1730
|
+
### Example
|
|
1731
|
+
|
|
1732
|
+
```sh
|
|
1733
|
+
umask 022
|
|
1734
|
+
umask
|
|
1735
|
+
```
|
|
1736
|
+
|
|
1737
|
+
Output:
|
|
1738
|
+
|
|
1739
|
+
```text
|
|
1740
|
+
0022
|
|
1741
|
+
```
|
|
1742
|
+
## unalias
|
|
1743
|
+
|
|
1744
|
+
Remove aliases.
|
|
1745
|
+
|
|
1746
|
+
### Usage
|
|
1747
|
+
|
|
1748
|
+
```sh
|
|
1749
|
+
unalias [-a] [--] NAME ...
|
|
1750
|
+
```
|
|
1751
|
+
|
|
1752
|
+
### Options and forms
|
|
1753
|
+
|
|
1754
|
+
- `-a`: Remove every alias.
|
|
1755
|
+
- `--`: Stop option parsing.
|
|
1756
|
+
|
|
1757
|
+
### Example
|
|
1758
|
+
|
|
1759
|
+
```sh
|
|
1760
|
+
alias ll='ls -l'
|
|
1761
|
+
unalias ll
|
|
1762
|
+
type ll
|
|
1763
|
+
```
|
|
1764
|
+
|
|
1765
|
+
Output:
|
|
1766
|
+
|
|
1767
|
+
```text
|
|
1768
|
+
ll not found
|
|
1769
|
+
```
|
|
1770
|
+
## uname
|
|
1771
|
+
|
|
1772
|
+
Print system information.
|
|
1773
|
+
|
|
1774
|
+
### Usage
|
|
1775
|
+
|
|
1776
|
+
```sh
|
|
1777
|
+
uname [-asnrvmp]
|
|
1778
|
+
```
|
|
1779
|
+
|
|
1780
|
+
### Options and forms
|
|
1781
|
+
|
|
1782
|
+
- `-a`: Select all supported fields.
|
|
1783
|
+
- `-s`: System name.
|
|
1784
|
+
- `-n`: Host name.
|
|
1785
|
+
- `-r`: OS release.
|
|
1786
|
+
- `-v`: OS version.
|
|
1787
|
+
- `-m`: Machine architecture.
|
|
1788
|
+
- `-p`: Processor architecture. Short flags may be combined.
|
|
1789
|
+
|
|
1790
|
+
### Example
|
|
1791
|
+
|
|
1792
|
+
```sh
|
|
1793
|
+
uname -mprs
|
|
1794
|
+
```
|
|
1795
|
+
|
|
1796
|
+
Output:
|
|
1797
|
+
|
|
1798
|
+
```text
|
|
1799
|
+
Linux 6.17.0-PRoot-Distro aarch64 aarch64
|
|
1800
|
+
```
|
|
1801
|
+
## unset
|
|
1802
|
+
|
|
1803
|
+
Remove shell variables.
|
|
1804
|
+
|
|
1805
|
+
### Usage
|
|
1806
|
+
|
|
1807
|
+
```sh
|
|
1808
|
+
unset [-v] [--] NAME ...
|
|
1809
|
+
```
|
|
1810
|
+
|
|
1811
|
+
### Options and forms
|
|
1812
|
+
|
|
1813
|
+
- `-v`: Explicitly select variables (the only supported unset kind).
|
|
1814
|
+
- `--`: Stop option parsing.
|
|
1815
|
+
|
|
1816
|
+
### Example
|
|
1817
|
+
|
|
1818
|
+
```sh
|
|
1819
|
+
NAME=value
|
|
1820
|
+
unset NAME
|
|
1821
|
+
echo "${NAME:-missing}"
|
|
1822
|
+
```
|
|
1823
|
+
|
|
1824
|
+
Output:
|
|
1825
|
+
|
|
1826
|
+
```text
|
|
1827
|
+
missing
|
|
1828
|
+
```
|
|
1829
|
+
## wc
|
|
1830
|
+
|
|
1831
|
+
Count lines, words, and bytes.
|
|
1832
|
+
|
|
1833
|
+
### Usage
|
|
1834
|
+
|
|
1835
|
+
```sh
|
|
1836
|
+
wc [-lwc] [FILE ...]
|
|
1837
|
+
```
|
|
1838
|
+
|
|
1839
|
+
### Options and forms
|
|
1840
|
+
|
|
1841
|
+
- `-l`: Count lines.
|
|
1842
|
+
- `-w`: Count words.
|
|
1843
|
+
- `-c`: Count bytes. Short flags may be combined.
|
|
1844
|
+
|
|
1845
|
+
### Example
|
|
1846
|
+
|
|
1847
|
+
```sh
|
|
1848
|
+
printf 'one two\n' | wc -lwc
|
|
1849
|
+
```
|
|
1850
|
+
|
|
1851
|
+
Output:
|
|
1852
|
+
|
|
1853
|
+
```text
|
|
1854
|
+
1 2 8
|
|
1855
|
+
```
|
|
1856
|
+
## whence
|
|
1857
|
+
|
|
1858
|
+
Describe command lookup.
|
|
1859
|
+
|
|
1860
|
+
### Usage
|
|
1861
|
+
|
|
1862
|
+
```sh
|
|
1863
|
+
whence [-pv] NAME ...
|
|
1864
|
+
```
|
|
1865
|
+
|
|
1866
|
+
### Options
|
|
1867
|
+
|
|
1868
|
+
- `-p`: Search `PATH` only, ignoring aliases, functions, and builtins.
|
|
1869
|
+
- `-v`: Print a verbose description of how each name resolves.
|
|
1870
|
+
|
|
1871
|
+
### Example
|
|
1872
|
+
|
|
1873
|
+
```sh
|
|
1874
|
+
whence -p bun
|
|
1875
|
+
```
|
|
1876
|
+
|
|
1877
|
+
Output:
|
|
1878
|
+
|
|
1879
|
+
```text
|
|
1880
|
+
/data/data/com.termux/files/usr/bin/bun
|
|
1881
|
+
```
|
|
1882
|
+
## which
|
|
1883
|
+
|
|
1884
|
+
Print executable paths found through PATH.
|
|
1885
|
+
|
|
1886
|
+
### Usage
|
|
1887
|
+
|
|
1888
|
+
```sh
|
|
1889
|
+
which NAME ...
|
|
1890
|
+
```
|
|
1891
|
+
|
|
1892
|
+
### Behavior
|
|
1893
|
+
|
|
1894
|
+
- `which` explicitly searches the current `PATH`, even when normal PATH command
|
|
1895
|
+
lookup is disabled by `bunmsh --builtin-only` or `tab path off`.
|
|
1896
|
+
- Use command substitution such as `"$(which NAME)"` to obtain an explicit path
|
|
1897
|
+
and run an external command in either mode.
|
|
1898
|
+
|
|
1899
|
+
### Example
|
|
1900
|
+
|
|
1901
|
+
```sh
|
|
1902
|
+
which bun
|
|
1903
|
+
```
|
|
1904
|
+
|
|
1905
|
+
Output:
|
|
1906
|
+
|
|
1907
|
+
```text
|
|
1908
|
+
/data/data/com.termux/files/usr/bin/bun
|
|
1909
|
+
```
|
|
1910
|
+
|
|
1911
|
+
To explicitly run a PATH command while normal PATH lookup is disabled:
|
|
1912
|
+
|
|
1913
|
+
```sh
|
|
1914
|
+
tab path off
|
|
1915
|
+
"$(which sh)" -c 'printf path-command'
|
|
1916
|
+
```
|
|
1917
|
+
|
|
1918
|
+
Output:
|
|
1919
|
+
|
|
1920
|
+
```text
|
|
1921
|
+
path-command
|
|
1922
|
+
```
|
|
1923
|
+
## yes
|
|
1924
|
+
|
|
1925
|
+
Repeatedly write the strings, or y by default.
|
|
1926
|
+
|
|
1927
|
+
### Usage
|
|
1928
|
+
|
|
1929
|
+
```sh
|
|
1930
|
+
yes [STRING ...]
|
|
1931
|
+
```
|
|
1932
|
+
|
|
1933
|
+
### Example
|
|
1934
|
+
|
|
1935
|
+
```sh
|
|
1936
|
+
yes ok | head -n 3
|
|
1937
|
+
```
|
|
1938
|
+
|
|
1939
|
+
Output:
|
|
1940
|
+
|
|
1941
|
+
```text
|
|
1942
|
+
ok
|
|
1943
|
+
ok
|
|
1944
|
+
ok
|
|
1945
|
+
```
|