Skip to content

Shell reference ​

Xila's command-line shell implements a bounded command language for interactive use and shell -c. It is intentionally smaller than POSIX shell syntax.

Invocation ​

Interactive input is parsed one line at a time. When the shell executable receives already-separated arguments, those arguments are preserved literally. Use -c to explicitly parse command source:

text
shell -c 'echo first | wc -l'

EOF executes a final unterminated interactive line.

Composition operators ​

sh
export NAME='hello world'; echo "$NAME"
echo first > /temporary/example; echo second >> /temporary/example
cat < /temporary/example | wc -l
missing-command 2> /temporary/errors || echo recovered
long-running-command > /temporary/result & echo foreground
SyntaxBehavior
A | BRun pipeline stages concurrently; the pipeline status is B's status.
A && BRun B only when A succeeds.
A || BRun B only when A fails.
A ; BRun sequential command lists.
A &Start the preceding conditional list in a background task.
< FILERead standard input from FILE.
> FILECreate/truncate FILE for standard output.
>> FILEAppend standard output to FILE.
2> FILECreate/truncate FILE for standard error.
2>> FILEAppend standard error to FILE.

| binds more tightly than && and ||. The two conditional operators have equal precedence and evaluate left to right. Redirections belong to one command, are applied left to right, and override a pipeline endpoint when they target the same stream.

Background input is /devices/null. Output and error inherit the shell's streams unless redirected and may interleave with foreground output. The shell supports up to eight active background lists; job listing, cancellation, and foreground/background switching are not implemented.

Quoting and expansion ​

  • Single quotes preserve contents literally.
  • Double quotes allow variable expansion.
  • Outside single quotes, backslash protects the following character.
  • Inside double quotes, backslash protects $, ", and \.
  • # at a word boundary begins a comment.
  • $NAME, ${NAME}, and $? expand while a command is prepared.
  • Variable names use ASCII letters, digits, and underscores, with a letter or underscore first.
  • Missing variables expand to an empty string.

Expansion does not split a variable value on whitespace and does not reinterpret the value as shell operators. Quoted and unquoted fragments may form one argument.

Exit statuses ​

CaseStatus
Success0
General built-in failure1
false1
Malformed shell -c source2
Unknown command127
External executablePreserved within 0–255
PipelineStatus of the last stage
Successful background-list launchSets $? to 0

$? contains the preceding foreground status.

Resource limits ​

ResourceLimit
Source line4096 bytes
Tokens per line256
Commands per line32
Stages per pipeline8
Expanded arguments and redirection paths per command8192 bytes
Buffered formatted output per built-in8192 bytes
Buffered bytes per pipe512
Active background lists per shell8

These limits bound shell-owned parsing and pipe storage. They do not bound allocations made by launched commands, inherited environment data, the WASM runtime, or task infrastructure.

Built-in commands ​

help lists registered built-ins and executable entries found in the task's Paths locations. help COMMAND prints usage for a built-in without launching it.

The current built-in registry contains:

AreaCommands
Shell/statetrue, false, exit, cd, pwd, clear, help
Environmentexport, unset, printenv, which
Files/directoriesls, cat, stat, mkdir, rm, rmdir, realpath, touch, mv
Text/streamsecho, grep, wc, head, tail, tree
Timingsleep
Permissionschmod
Networkweb_request, dns_resolve, ping, ip

Selected recent utilities:

  • grep PATTERN [FILE]... performs literal substring matching and reads standard input when no file is supplied or a file operand is -.
  • touch FILE... creates missing files and updates access and modification times.
  • realpath PATH... prints canonical absolute paths for existing files/directories.
  • sleep DURATION accepts a nonnegative integer followed by ms, s, m, or h; no suffix means seconds.
  • chmod MODE PATH accepts octal permissions from 000 through 777, optionally with a leading zero.
  • tree [-L N] [PATH] streams a hierarchy without collecting sibling entries; depth is bounded to 32.
  • mv SOURCE DESTINATION renames within one mounted filesystem and uses the exact destination path.

Use help COMMAND for the authoritative option syntax of built-ins not detailed here.

Unsupported shell syntax ​

The current language does not implement script files, multiline syntax, command substitution, globbing, subshells, descriptor duplication such as 2>&1, here-documents, or shell assignment syntax. Newline characters inside explicit command source are whitespace; use ; to separate commands.