This is the Rust version of my bsh shell program.
- 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
- learn idiomatic Rust
- make the C version of
bsh
more memory safe by using Rust's memory safety principles - contribute back to the Rust ecosystem
$ 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 ...]
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
# 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
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
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.