Usage Syntax
Positional Arguments
Shell script file to execute from the host filesystem.If no script is provided and stdin is a TTY, Nash starts in interactive REPL mode.
Standard Shell Flags
These flags are compatible with bash, sh, and other POSIX shells.Execute a command string and exit.Equivalent to bash’s
-c flag.Force interactive mode even when stdin is not a TTY.Useful for debugging or when you want the REPL despite piped input.
Login shell mode. Sources Can be combined with script execution:
/etc/profile then ~/.nashrc from the VFS.Read commands from stdin instead of starting the REPL or running a script.When stdin is not a TTY,
-s is implicit if no script or -c is provided.Exit immediately if any command exits with a non-zero status.Equivalent to
set -e in bash. Critical for robust scripts.Treat references to unset variables as errors.Equivalent to
set -u in bash.Print each command to stderr before executing.Output example:Equivalent to
set -x in bash. Essential for debugging scripts.Print each input line to stderr as it is read, before parsing.Equivalent to
set -v in bash.Combining Shell Flags
Flags can be combined for powerful script control:Nash-Specific Flags
These flags control Nash’s sandboxing and VFS behavior.Set the session username. Creates Prompt output:The username must be 1-32 characters, alphanumeric plus
/home/<username> and sets $USER, $LOGNAME, and $HOME._ and -.Override the starting directory inside the VFS.Default:
/home/<username>The directory is created if it doesn’t exist.Set environment variables inside Nash using Variables set with
KEY=VALUE format. Repeatable.-E override defaults and are accessible via $KEY:Mount a host directory into the VFS read-write. Format: Files in the host directory become accessible at the VFS path:Writes inside the VFS path are reflected on the host filesystem.
HOST:VFS. Repeatable.Mount a host directory into the VFS read-only. Format: Attempts to write to the mount point will fail:
HOST:VFS. Repeatable.Mount Examples
- Single mount
- Multiple mounts
- Script with mount
/project with host ./project mounted read-write.General Options
Source a custom rc file instead of the default The rc file is sourced from the VFS if present, otherwise from the host filesystem.
~/.nashrc.Do not source any rc file on startup.Useful for clean, reproducible environments.
Print the Nash version and exit.Output:
Print help information and exit.Displays usage, flags, and examples.
Flag Combinations
Nash flags can be combined to create powerful, customized environments.Development Environment
- User:
dev - Working directory:
/workspace - Host
./projectmounted at/workspace - Environment:
DEBUG=true,NODE_ENV=development
Strict Script Execution
-e: Exit on error-u: Error on undefined variables-x: Trace execution- Read-only config mount
- Production environment variable
Isolated Testing
- No rc file loaded
- Starts in
/tmp - Custom test environment
Default Environment Variables
Nash sets these environment variables by default (overridable with-E):
| Variable | Default Value |
|---|---|
USER | Username from -U (default: user) |
LOGNAME | Same as USER |
HOME | /home/<user> |
SHELL | nash |
TERM | xterm-256color |
LANG | en_US.UTF-8 |
LC_ALL | en_US.UTF-8 |
PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
PWD | Current working directory |
OLDPWD | Previous directory (for cd -) |
HOSTNAME | nash |
SHLVL | 1 |
_ | nash |
- | Active shell flags (e.g., eux) |
Overriding Defaults
Execution Mode Priority
When multiple flags are provided, Nash follows this priority order:-c CMD→ Execute command string and exit-s→ Read from stdinSCRIPT→ Run script file-i→ Force interactive REPL- Stdin is TTY → Interactive REPL (default)
- Stdin is pipe → Read from stdin (implicit
-s)
If
-c is provided, all other execution modes are ignored.Examples
Quick Command
Interactive with Custom User
Script with Debugging
Mounted Workspace
Production Script Runner
See Also
- Interactive Mode - Using the Nash REPL
- Script Execution - Running scripts
- RC Files - Initialization and configuration
