Skip to content

Repository files navigation

bsh-rs

BSH CI

This is the Rust version of my bsh shell program.

Features

  • runs builtin and external commands
  • expands history and environment variables
  • supports |, ;, ||, &&
  • supports job control
  • has the following builtins:
    • cd
    • history
    • kill
    • exit
    • bg, fg, jobs
    • declare, unset

Goals

Usage

$ bsh --help
bsh.

Usage:
    bsh [options]
    bsh [options] -c <command>
    bsh [options] <file>
    bsh (-h | --help)
    bsh --version

Options:
    -h --help       Show this screen.
    --version       Show version.
    -c              If the -c option is present, then commands are read from the first non-option
                        argument command_string.
    --log=<path>    File to write log to, defaults to ~/.bsh_log
$ bsh
0|~/code
$ help
bg: bg [<jobspec>...]
cd: cd [dir]
declare: declare [name[=value] ...]
exit: exit [n]
fg: fg [job_spec]
help: help [command ...]
history: history [-c] [-s size] [n]
jobs: jobs [options] [<jobspec>...]
kill: kill pid | %jobspec
unset: unset [name ...]

Installation

git clone https://github.com/rgardner/bsh-rs
cd bsh-rs
# run bsh via cargo
cargo run
# run bsh directly
target/debug/bsh
# display bsh help
target/debug/bsh --help

Development

# setup dev environment (e.g. git hooks)
./scripts/dev_setup.sh
# Check program for errors, quicker than full build
cargo check
# build
cargo build
# run lints
cargo clippy
# run tests
cargo test
# generate documentation
cargo doc --document-private-items

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Bash-like shell (builtins, job control, piping) written in Rust

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages