The preview shell

DataMind Oda's browser preview includes a shell for running commands against the preview's own filesystem, not the files on your computer. It is not bash: it runs a fixed command table with a fixed command-line grammar, and it refuses the rest by name. How the preview starts and what it mounts is on Browser preview; what it does not support at all is on Preview limitations; what its messages mean is on Preview diagnostics.

How a command runs

The command table

Everything you can run is built into the shell. A name outside the table is not found instead of looked up.

How a command line is read

Expansions

What the shell prints

A failure is reported the way a shell utility reports it, not as a raw system error. The shell's own messages carry the bash: prefix, the name the interpreter reports for itself.

Exit codeMeaning
0The command finished successfully.
1A command reported a failure, or a broken program was contained.
2The line could not be parsed, or a built-in or utility was used wrongly.
125The sandbox launcher failed before the command ran.
127The name is not in the command table.
130The line was aborted, or the command was stopped.

Stopping a command

The sandbox around a command

Questions, answered

Which commands does the preview shell have?

The table is fixed: shell built-ins cd, pwd, export, unset, env, printenv, exit, test, [, sleep, date, seq, true, false and :; file tools ls, mkdir, cp, mv, rm, rmdir, touch, find, stat and basename; text tools echo, printf, cat, head, tail, wc, grep, sort, uniq, cut, tr, sed and tee; and which. A name outside the table reports command not found.

Why does a command I use every day report command not found?

The shell runs nothing from the machine: every command is built in, so a name the preview does not implement is not found. which <name> tells you whether a name exists here.

Can I use loops, functions or case in the preview shell?

No. The interpreter understands chaining (;, &&, ||), pipelines (|, |&), subshells, groups, redirections and command substitution, and that is the whole grammar. Loops, functions, case and job control are not part of it.

Does a command ending in & run in the background?

No. There is no scheduler here, so the command runs to completion in place, before anything after it on the line.

Why is a file empty after > even though the command wrote nothing to it?

The redirect truncates its file when it is set up, not when the command writes to it. A command that writes nothing still leaves an empty file there; >> appends instead.

Why does a cd inside a subshell not change my working folder?

A subshell runs on a copy of the shell's state, so a cd or a variable set inside it is gone when it ends. A group shares the state, so its changes stay.

Can I run a full sed script in the preview shell?

No. sed runs substitution scripts only, written as s/pattern/replacement/ with the g and i modifiers; anything else is refused with sed: only substitution scripts (s/pattern/replacement/) run in the worker host.

What do the exit codes mean?

0 success, 1 a failure or a contained program defect, 2 a parse or usage error, 125 a sandbox launcher failure before the command ran, 127 a name outside the command table, and 130 a line that was aborted or a command that was stopped.

Why did my command end with status 130?

It was aborted or stopped, either by you or because its line was cancelled. The final result of an aborted run carries no output of its own; anything already forwarded while it ran stays readable.

What does permission denied mean here?

The sandbox denied the access: the command tried to read or write outside its grants. The mode a command runs under decides what is allowed, and workspace-write denies writes outside the workspace and its temporary folder.

Why does which call commands shell built-ins?

Because every command is built into the shell. There are no program files to point at, so which reports a known name as <name>: shell built-in command instead of a path.

Why do the shell's messages start with bash:?

That is the name the interpreter answers to ($0 reads bash), and its diagnostics keep the shape of a shell utility's output. The shell itself is not bash: the command table and grammar on this page are its own.