Skip to content
/ ilsh Public

`ilsh` - A POSIX-Compliant Shell (CLI) Implementation in Rust

License

Notifications You must be signed in to change notification settings

ivanbgd/ilsh

Repository files navigation

ilsh - A POSIX-Compliant Shell (CLI) Implementation in Rust

license Crates.io docs.rs CI Security audit pre-commit

Supported Builtin Commands

Notes

  • Mostly bash is used as a reference, but not everything is in accordance with bash.
  • Supports running external programs with arguments.
    • External programs are located using the PATH environment variable.
  • Supports single quotes.
  • Supports double quotes.
  • Supports escape character outside quotes.
  • Supports redirecting output.
  • Supports appending redirected output.
  • Supports shell-specific &>word and shell-specific >&word, which redirect both stdout and stderr to the file whose name is the expansion of word.
  • Supports multiple redirections.

Security

Development

Pre-commit

pre-commit hooks are supported.

$ pip install pre-commit  # If you don't already have pre-commit installed on your machine. Run once.
$ pre-commit autoupdate  # Update hook repositories to the latest versions.
$ pre-commit install  # Sets up the pre-commit git hook script for the repository. Run once.
$ pre-commit install --hook-type pre-push  # Sets up the pre-push git hook script for the repository. Run once.
$ pre-commit run  # For manual running; considers only modified files.
$ pre-commit run --all-files  # For manual running; considers all files.

After installing it, the provided pre-commit hook(s) will run automatically on git commit.

Running the Program

cargo run --release
export DEBUG=false
cargo run --release

A run script is provided.

The run script can set the DEBUG environment variable to false or true.

./run.sh

Building and Running the Program with Debug Output

The program supports debugging output, which can be enabled by setting the environment variable DEBUG to the value true.

It can be set outside the program, in the user shell, or inside the run.sh shell script.

This is only considered during compile time, and not during run time.

DEBUG=true ./run.sh
export DEBUG=true
./run.sh

Testing

  • Unit-test with cargo test.
  • End-to-end-test with ./test.sh.

Releases

No releases published

Packages

No packages published