former name: Rusty Bash
Bash-completion starts working on our shell! (how to use)
A clone of Bash, which is developed as a hobby of our group and for monthly articles on SoftwareDesign magazine published by Gijutsu-Hyohron Co., Ltd.
$ git clone https://github.com/shellgei/rusty_bash.git
$ cd rusty_bash
$ cargo run
ใปใปใป
Finished dev [unoptimized + debuginfo] target(s) in 0.04s
Running `target/debug/sush`
ueda@uedaP1g6:main๐ต~/GIT/rusty_bash(debug)๐ฃ$ git clone https://github.com/shellgei/rusty_bash.git
$ cd rusty_bash
$ cargo build --release
### โ Change /bin/ to /usr/local/bin/ or another path in $PATH if you are using Mac or BSD ###
$ sudo cp target/release/sush /bin/
$ cp .sushrc ~/.sushrc # edit if some errors occur
$ sush
ueda@uedaP1g6:main๐ต~/GIT/rusty_bash๐ฃThis graph shows the test result with the script in ./sush_test/bash_genuine_test of this test repository. Currently, the binary built from alpha repo has passed 27 of 84 test scripts.
The following behavior of Bash will not be imitated by sush. So we alter the right output file (e.g globstar.right) for comparision.
- the output order of associative array
- output duplication of globstar
- Bash outputs the same path repeatedly in some situations of globstar. It may be for compatibility of ksh.
- overflow at calculations
- Bash outputs overflow calculation results at the border of 64 bit intergers and
arith5.subtells that this behavior should be reproduced. But we don't follow it.
### Bash example ### $ echo $(( -9223372036854775808 * -1 )) -9223372036854775808 #IT'S WRONG. $ echo $(( -9223372036854775807 * -1 )) #IT'S OK. 9223372036854775807 ### Sushi shell ### ๐ฃ echo $(( -9223372036854775808 * -1 )) 9223372036854775808 ๐ฃ echo $(( -9223372036854775807 * -1 )) 9223372036854775807
- Bash outputs overflow calculation results at the border of 64 bit intergers and
- spaces of error log
- Bash adds spaces to each token and displays them in error messages. These spaces are elliminated in our shell.
### Bash ### $ (( 1++ )) bash: ((: 1++ : syntax error: operand expected (error token is "+ ") ### Sush ### ๐ฃ (( 1++ )) sush: ((: 1++ : syntax error: operand expected (error token is "+")
- error messages of
readonly- We added
readonly:to the messages inattr.right.- e.g.:
./attr.tests: line 17: a: readonly variable->./attr.tests: line 17: readonly: a: readonly variable
- e.g.:
- We added
Because the shell in this repository can be a standard one in the next generation, it may a good idea to leave your name as a contributor. Give us pull requests with what you think as contribution. As our community is not big, rules have not been fixed yet.
Followings are not difficult but very important tasks.
- To fix the code based on Clippy. (There are many warnings by Clippy in the current codes. )
- To develop builtin commands. (Especially
echomay be easy. ) - To add test cases.
- To fix the test methodology, especially for the parts related to human input.
- alpha: checkout this branch if you want to develop.
- beta: we are using the head version of this branch on a day-to-day basis.
- main: the beta version is merged to this branch if fatal problems are not found for a week.
- โ๏ธ :available
- ๐ง :partially available (or having known bugs)
- ๐ : not implemented
| features | status | features | status | features | status |
|---|---|---|---|---|---|
| if | โ๏ธ | while | โ๏ธ | () | โ๏ธ |
| {} | โ๏ธ | case | โ๏ธ | until | ๐ |
| for | โ๏ธ | [[ ]] | โ๏ธ |
| features | status | features | status | features | status |
|---|---|---|---|---|---|
| $ | โ๏ธ | ? | โ๏ธ | * | โ๏ธ |
| @ | โ๏ธ | # | โ๏ธ | - | โ๏ธ |
| ! | ๐ | _ | โ๏ธ |
| features | status | features | status | features | status |
|---|---|---|---|---|---|
| cd | โ๏ธ | pwd | โ๏ธ | read | ๐ง |
| exit | โ๏ธ | source | โ๏ธ | set | ๐ง |
| shopt | ๐ง | : | โ๏ธ | . | โ๏ธ |
| alias | โ๏ธ | bg | ๐ง | bind | ๐ |
| break | โ๏ธ | builtin | โ๏ธ | caller | ๐ |
| command | โ๏ธ | compgen | ๐ง | complete | ๐ง |
| compopt | ๐ | continue | โ๏ธ | declare | ๐ |
| dirs | ๐ | disown | ๐ | echo | ๐ |
| enable | ๐ | eval | โ๏ธ | exec | ๐ |
| fc | ๐ | fg | ๐ง | getopts | ๐ง |
| hash | ๐ | help | ๐ | history | ๐ง |
| jobs | ๐ง | kill | ๐ | let | ๐ |
| local | โ๏ธ | logout | ๐ | mapfile | ๐ |
| popd | ๐ | printf | ๐ | pushd | ๐ |
| readonly | ๐ | return | โ๏ธ | false | โ๏ธ |
| shift | โ๏ธ | suspend | ๐ | test | ๐ |
| times | ๐ | trap | ๐ | true | โ๏ธ |
| type | ๐ | typeset | ๐ | ulimit | ๐ |
| umask | ๐ | unalias | โ๏ธ | unset | ๐ง |
| wait | ๐ง | export | ๐ |
| features | status | features | status | features | status |
|---|---|---|---|---|---|
| -c | โ๏ธ | -i | โ๏ธ | -l, --login | ๐ |
| -r | ๐ | -s | ๐ | -D | ๐ |
| [-+]O | ๐ | -- | ๐ | --debugger | ๐ |
| --dimp-po-strings | ๐ | --help | โ๏ธ | --init-file | ๐ |
| --rcfile | ๐ | --noediting | ๐ | --noprofile | ๐ |
| --norc | ๐ | --posix | ๐ | --restricted | ๐ |
| -v, --verbose | ๐ | --version | โ๏ธ | -e | โ๏ธ |
| --pipefail | โ๏ธ | -B | โ๏ธ |
| features | status | features | status | features | status |
|---|---|---|---|---|---|
| autocd | ๐ | cdable_vars | ๐ | cdspell | ๐ |
| checkhash | ๐ | checkjobs | ๐ | checkwinsize | ๐ |
| cmdhist | ๐ | compat31 | ๐ | compat32 | ๐ |
| compat40 | ๐ | compat41 | ๐ | dirspell | ๐ |
| dotglob | โ๏ธ | execfail | ๐ | expand_aliases | ๐ |
| extdebug | ๐ | extglob | โ๏ธ | extquote | ๐ |
| failglob | ๐ | force_fignore | ๐ | globstar | ๐ |
| gnu_errfmt | ๐ | histappend | ๐ | histreedit | ๐ |
| histverify | ๐ | hostcomplete | ๐ | huponexit | ๐ |
| interactive_comments | ๐ | lastpipe | ๐ | lithist | ๐ |
| login_shell | ๐ | mailwarn | ๐ | no_empty_cmd_completion | ๐ |
| nocaseglob | ๐ | nocasematch | ๐ | nullglob | โ๏ธ |
| progcomp | โ๏ธ | promptvars | ๐ | restricted_shell | ๐ |
| shift_verbose | ๐ | sourcepath | ๐ | xpg_echo | ๐ |
Born Shell Variables
| features | status | features | status | features | status |
|---|---|---|---|---|---|
| CDPATH | ๐ | HOME | โ๏ธ | IFS | ๐ง |
| ๐ | MAILPATH | ๐ | OPTARG | โ๏ธ | |
| OPTIND | โ๏ธ | PATH | โ๏ธ | PS1 | โ๏ธ |
| PS2 | โ๏ธ |
Bash Variables
| features | status | features | status | features | status |
|---|---|---|---|---|---|
| _ | โ๏ธ | BASH | ๐ | BASHOPTS | ๐ |
| BASHPID | โ๏ธ | BASH_ALIASES | ๐ | BASH_ARGC | ๐ |
| BASH_ARGV | ๐ | BASH_ARGV0 | ๐ | BASH_CMDS | ๐ |
| BASH_COMMAND | ๐ | BASH_COMPAT | ๐ | BASH_ENV | ๐ |
| BASH_EXECUTION_STRING | ๐ | BASH_LINENO | ๐ | BASH_LOADABLES_PATH | ๐ |
| BASH_REMATCH | โ๏ธ | BASH_SOURCE | ๐ | BASH_SUBSHELL | โ๏ธ |
| BASH_VERSINFO | โ๏ธ | BASH_VERSION | โ๏ธ | BASH_XTRACEFD | ๐ |
| CHILD_MAX | ๐ | COLUMNS | ๐ | COMP_CWORD | ๐ |
| COMP_LINE | ๐ | COMP_POINT | ๐ | COMP_TYPE | ๐ |
| COMP_KEY | ๐ | COMP_WORDBREAKS | ๐ | COMP_WORDS | ๐ |
| COMPREPLY | ๐ | COPROC | ๐ | DIRSTACK | ๐ |
| EMACS | ๐ | ENV | ๐ | EPOCHREALTIME | โ๏ธ |
| EPOCHSECONDS | โ๏ธ | EUID | ๐ | EXECIGNORE | ๐ |
| FCEDIT | ๐ | FIGNORE | ๐ | FUNCNAME | ๐ |
| FUNCNEST | ๐ | GLOBIGNORE | ๐ | GROUPS | ๐ |
| histchars | ๐ | HISTCMD | ๐ | HISTCONTROL | ๐ |
| HISTFILE | โ๏ธ | HISTFILESIZE | โ๏ธ | HISTIGNORE | ๐ |
| HISTSIZE | ๐ | HISTTIMEFORMAT | ๐ | HOSTFILE | ๐ |
| HOSTNAME | ๐ | HOSTTYPE | โ๏ธ | IGNOREEOF | ๐ |
| INPUTRC | ๐ | INSIDE_EMACS | ๐ | LANG | โ๏ธ |
| LC_ALL | ๐ | LC_COLLATE | ๐ | LC_CTYPE | ๐ |
| LC_MESSAGES | ๐ | LC_NUMERIC | ๐ | LC_TIME | ๐ |
| LINENO | โ๏ธ | LINES | ๐ | MACHTYPE | โ๏ธ |
| MAILCHECK | ๐ | MAPFILE | ๐ | OLDPWD | โ๏ธ |
| OPTERR | ๐ | OSTYPE | โ๏ธ | PIPESTATUS | โ๏ธ |
| POSIXLY_CORRECT | ๐ | PPID | ๐ | PROMPT_COMMAND | ๐ |
| PROMPT_DIRTRIM | ๐ | PS0 | ๐ | PS3 | ๐ |
| PS4 | โ๏ธ | PWD | โ๏ธ | RANDOM | โ๏ธ |
| READLINE_ARGUMENT | ๐ | READLINE_LINE | ๐ | READLINE_MARK | ๐ |
| READLINE_POINT | ๐ | REPLY | ๐ | SECONDS | โ๏ธ |
| SHELL | โ๏ธ | SHELLOPTS | ๐ | SHLVL | โ๏ธ |
| SRANDOM | โ๏ธ | TIMEFORMAT | ๐ | TMOUT | ๐ |
| TMPDIR | ๐ | UID | ๐ |
| features | status |
|---|---|
| repeat command | โ๏ธ |
| branch display in prompt | โ๏ธ |
Partially in Japanese.
- blog articles
- Rustใงใทใงใซไฝใฃใ | ฮบeenใฎHappy Hacฮบing Blog
- Rustใงๅงใใ่ชไฝใทใงใซ ใใฎ1 | ใถใฆใใฎใญใฐใงใถใญใฐ
- Rustใฎใฟใผใใใซๆไฝcrateใใใใ | meganehouser
- ๅ็ๅๅใง็่งฃใใใใฉใขใฐใฉใฆใณใใใญใปในใจใใใฏใฐใฉใฆใณใใใญใปในใฎ้ใ | @tajima_taso
- Bashใฟใ่ฃๅฎ่ชไฝๅ ฅ้ | Cybouzu Inside Out
ยฉ 2022-2025 shellgei group
- Ryuichi Ueda: @[email protected], @ueda.tech (https://bsky.app/profile/ueda.tech)
- @[email protected]

