Ends a loop and optionally causes the loop to return the result of the provided expression. A loop is an expression and thus a loop returns a result. The break command may be used to end a loop prematurely and to cause it to return the value of the expression that is passed to the break command.
The break command evaluates to void if no expression is provided.
Note that a break command may only appear inside of a loop body.
break [expr]
expr
: the expression that should be evaluated to calculate the result value of a loop
Set the current working directory to the directory indicated by the provided path.
cd <path>
path
: path to a directory
Clears the screen.
cls
Causes a return to the beginning of the loop.
Note that the continue command may only appear inside of a loop body.
continue
Deletes one or more directories or files indicated by the provided path(s). A directory must be empty to be eligible for deleting.
delete <path ...>
path ...
: one or more paths to files or directories
Pauses execution for 'ms' milliseconds.
delay <ms>
ms
: a positive integer giving a duration in milliseconds
Prints the given list of strings separated by single space characters to standard out. The list of strings is followed by a single newline character. Note that all strings following a '--' parameter are printed verbatim and not interpreted as an option even if they start with '-' or '--' characters.
echo [-n | --noline] [-s | --nospace] <strings ...>
--noline, -n
: tells echo that it should not print an extra newline at the end of the line--nospace, -s
: tells echo that it should not print an extra space between adjacent strings
strings ...
: one or more strings to print
Checks whether the file or directory at path 'path' exists and returns true if that is the case and false otherwise.
exists <path>
path
: path to a directory or file
Exits the current shell with the exit code 'exit_code'. The exit code is passed to the program that invoked the shell. An exit code of 0 is assumed if no exit code is provided.
exit <exit_code>
exit_code
: an integer that will be passed to the parent shell
Prints the contents of the shell history to standard out. Each history entry is printed as a separate line. The entries are printed in the order of newest to oldest.
history
Prints the real user and group id of the logged in user.
id
Causes the shell to evaluate the provided conditional expression to decide whether execution should continue with the provided then or else block. The else block is optional and execution continues with the first expression following the end of the then block if the conditional expression evaluates to false and there is no else block.
Note that an if command is an expression. This means that the result of the if expression is the result of the then block if the conditional expression evaluates to true, and the result of the else block otherwise.
if <cond_expr> <then_block> [else <else_block>]
cond_expr
: the conditional expressionthen_block
: the block to execute when the conditional expression evaluates to trueelse_block
: the block to execute when the conditional expression evaluates to false
Prints the prompt 'prompt' if provided and then allows the user to enter a line of text. Then returns the text that the user has entered.
input [prompt]
prompt
: a string
Defines a new immutable named variable in the current scope. An error is generated if a variable with that name already exists in the current scope. However, it is permissible to shadow a variable with the same name that was defined in one of the parent scopes.
The new variable is assigned the result of evaluating the provided initialization expression. Note that once created, the value of the variable can not be changed anymore.
The variable ceases to exist at the end of the current scope.
let <var_name> = <expr>
var_name
: a variable nameexpr
: an expression that is evaluated to calculate the value that should be assigned to the variable
Loads and returns the contents of a text file.
load <path>
path
: path to a text file
Lists the contents of one or more directories as indicated by the provided paths. Lists the contents of the current working directory if no path is provided. By default the list command does not list entries that start with a '.'. Pass the '--all' parameter to enable the output of all directory entries.
list [-a | --all] [path ...]
--all, -a
: tells the list command to show all files and directories, even hidden ones
path ...
: one or more paths to directories
Creates one or more empty directories at the file system locations designated by the provided paths. The last path component in a path specifies the name of the directory to create. Any non-existing intermediate directories are automatically created if you pass the '--parents' option.
makedir [-p | --parents] <path ...>
--parents, -p
: tells the makedir command that it should automatically create missing intermediate directories
path ...
: one or more paths to directories that should be created
Returns the absolute path of the current working directory.
pwd
Renames the file or directory located at a source path, to a file or directory at a destination path. If a file or directory already exists at the destination path then this file system object is atomically deleted and replaced with the source file or directory.
rename <src_path> <dst_path>
src_path
: path to a source file or directorydst_path
: path to a destination directory or file
Starts a new shell instance as a child process of the current shell. The new shell inherits all environment variables, the root directory and the current working directory of its parent shell. Exit the new shell by issuing an "exit" command on the command line. The shell runs in interactive mode by default.
If a string is provided as the last argument to the shell then this string is interpreted as the path to a shell script. The shell loads the script and executes it. The '--command' switch causes the shell to interpret the string as a shell command instead of a path to a script file. Multiple commands may be provided in a single string by separating them with a semicolon (';') character.
shell [-c | --command] [string]
--command, -c
: tells the shell that it should interpret the provided string as a command and execute it
string
: either the name of a script file or a string that should be interpreted as a command to execute
Writes the provided data to a new file at location 'path'. Any existing data is by default overridden. The provided data is appended to the end of an existing file if the '--append' switch is provided.
save [-a | --append] [-r | --raw] <data> to <path>
--append, -a
: tells the save command that it should append new data to an already existing file--raw, -r
: tells the save command that the input data is raw bytes rather than text
data
: the input data which may be text or raw bytespath
: path to a file
Prepares the computer for power off by writing still cached data to disk. It is safe to turn off power once this command has finished running.
shutdown
Prints the contents of the file 'path' to the console. Pass the switch '--hex' to print the file contents as a series of hexadecimal numbers.
type [--hex] <path>
--hex
: tells the type command that it should display the file contents in the form of a hex-dump
path
: path to a text or binary file
Returns the number of milliseconds that have elapsed since boot.
Defines a new mutable named variable in the current scope. An error is generated if a variable with that name already exists in the current scope. However, it is permissible to shadow a variable with the same name that was defined in one of the parent scopes.
The new variable is assigned the result of evaluating the provided initialization expression. Note that the type of the variable may be changed later to a different type by assigning a value with a different type to the variable.
The variable ceases to exist at the end of the current scope.
var <var_name> = <expr>
var_name
: a variable nameexpr
: an expression that is evaluated to calculate the value that should be assigned to the variable
Defines a while loop that executes its loop body as long as the conditional expression continues to evaluate to true. Once the conditional expression evaluates to false, the loop ends and execution continues with the first expression that follows the loop body.
A while loop is an expression. The result of the while expression is the result of the last expression inside the loop body if the loop is not prematurely ended by executing a break expression. If a loop is ended prematurely with the help of a break expression, then the value of the break expression is the result of the while loop.
while <cond_expr> <body>
cond_expr
: a conditional expressionbody
: the loop body