embedded shell (QNX)
esh [-c command] [-irv] [script_file]
Restricted operations include creating remote processes and specifying a path that starts with a double slash for cd and other command names. For more information, see the sections "Command-line format" and "Built-in commands."
Invoke a subshell:
esh
Invoke a subshell with a script file:
esh /etc/backup
Run the following command and exit:
esh -c "ls /bin"
The esh utility provides a subset of the functionality found in the standard QNX Shell, /bin/sh. You should find esh useful for situations where memory requirements are limited. For example, you could use it to run a simple system initialization file for an embedded system.
In esh, command lines take this form:
Where:
Specifying: | Will: |
---|---|
<file | redirect standard input from this file. |
>file | redirect standard output to this file. If the file exists, it's overwritten; if the file doesn't exist, it's created. |
>>file | redirect standard output to this file. If the file exists, the information is appended to the end of the file; if the file doesn't exist, it's created. |
2>file | do the same as >file, but for standard error. |
2>>file | do the same as >>file, but for standard error. |
& | If a command contains an unquoted &, then esh doesn't wait for the command to complete execution but immediately moves on to process the next command. The standard input of the command is redirected from /dev/null, and SIGINT and SIGQUIT are ignored. |
You use most QNX commands for manipulating files in one way or another. As such, esh has a filename "shorthand" (consisting of *, ?, [, and ]) you can use to specify the files that a command is to operate on. This shorthand is the same used by the standard QNX Shell. For more information, see "Filename expansion" in sh.
The following characters have a special meaning in esh:
& \ " * ? [ space
To suppress the special meaning of these characters and keep their literal meaning, you use quoting.
To quote a sequence of characters or sequence of words, enclose the sequence in double quotes. To quote a single character, use double quotes or precede it with the escape character (\).
The escape character (\) preserves the literal meaning of the next character. You can't obtain a single backslash by quoting \ with double quotes. To obtain a backslash, enter \\ instead.
Enclosing characters and words in double quotes ("") preserves the literal meaning of all characters within double quotes, with the exception of the \ character. For example:
"ab cd"
represents a single, five-character argument.
You can keep the literal meaning of a double quote with the \ character. For example:
ab\"cd
represents the single, five-character argument ab"cd.
The following commands are built into esh. That is, esh interprets and executes them internally.
alias [name=value]...
Without arguments, alias lists all aliases and their values. If only the name is specified, its value is listed. Any name specified with a value defines an alias.
Alias expansion occurs when the first word of a statement is a defined alias, except when that alias is already being expanded.
List all aliases:
alias
Remove an alias:
alias name=
cd [directory]
The cd utility changes the working directory of the current execution environment. If directory isn't specified, the value of the HOME environment variable becomes the new working directory. If restricted mode (-r) is set, you can't start the pathname with a double slash.
exec [command [argument...]]
The exec command opens, closes, or copies file descriptors as specified by any I/O redirections given as part of argument. If a command is specified, that command is spawned as a replacement for esh. Any specified arguments are passed to the spawned process.
If esh is operating in restricted mode (-r), the exec command cannot be used.
exit [n]
The exit command causes esh to exit with the exit status specified by n. If n isn't specified, esh exits with the status of the last command executed.
export name[=word]...
export -p
The export command marks the specified names for export, which will cause them to be in the environment of subsequently executed commands. If you specify the -p option, the names and values of all exported variables are written to the standard output.
If restricted mode (-r) is set, you can't use this command.
reopen [device]
The reopen command closes standard input, standard output, and standard error and attaches them to the specified device. This command is often used in sysinit files. If you don't specify a device, //0/dev/con1 is used.
If restricted mode (-r) is set, you can't use this command.
This command causes all commands to be echoed to the standard output before they're executed.
You can use the following variables to modify esh's environment:
If PATH isn't in the existing environment when esh is invoked, it is set to /bin:/usr/bin.