Releases: shellgei/rusty_bash
Releases Β· shellgei/rusty_bash
v0.8.11
Fixed bugs
- Fixed no reaction toward an index designation on referring a special parameter
### before ###
π£ echo ${@[1]}
π£ echo $?
0
### after ###
π£ echo ${@[1]}
sush: ${@[1]}: bad substitution
π£ echo $?
1
- Fixed wrong word splitting on
$@ and $ {array[@]} in a double quoted subword
### before ###
π£ set a b c ; for x in "@$@x" ; do echo $x ; done
@a
b
### after ###
π£ set a b c ; for x in "@$@x" ; do echo $x ; done
@a
b
cx
v0.8.10
Supported ${name/pattern/word}, ${name//pattern/word}, ${name/#pattern/word}, and ${name/%pattern/word}
Here are the examples:
π£ echo $BASH_VERSION
0.8.10(rusty_bash)-release
### replace once ###
π£ echo ${BASH_VERSION/0/X}
X.8.10(rusty_bash)-release
### replace all ###
π£ echo ${BASH_VERSION//0/X}
X.8.1X(rusty_bash)-release
### head only replace ###
π£ echo ${BASH_VERSION/#0*8/X}
X.10(rusty_bash)-release
π£ echo ${BASH_VERSION/#release/X}
0.8.10(rusty_bash)-release
### tail only replace ###
π£ echo ${BASH_VERSION/%release/X}
0.8.10(rusty_bash)-X
π£ echo ${BASH_VERSION/%0/X}
0.8.10(rusty_bash)-release
v0.8.9
Supported RANDOM
π£ echo $RANDOM
28778
π£ echo $RANDOM
22003
π£ echo $RANDOM
7483
v0.8.7
Supported command-not-found
example
ueda@uedax1:mainπ΅~/GIT/rusty_bashπ£ aaa
Command 'aaa' not found, did you mean:
command 'ara' from deb python3-ara (1.5.8-1.1ubuntu1)
command 'ava' from deb ava (5.3.1+dfsg+~cs46.3.10-3)
command 'jaaa' from deb jaaa (0.9.2-1)
command 'aha' from deb aha (0.5.1-3)
command 'aa' from deb astronomical-almanac (5.6-7)
Try: sudo apt install <deb name>
sush: aaa: command not found
how to use
Please write the following code to .sushrc at your home directory.
command_not_found_handle() {
/usr/lib/command-not-found -- "$1" # change the path to the command-not-found path on your environment
}
v0.8.5
Supported ${name#word}, ${name##word}, ${name%word}, ${name%%word}
Examples:
π£ A=usr/local/bin/bash; echo ${A#*/}
local/bin/bash
π£ A=usr/local/bin/bash; echo ${A##*/}
bash
π£ A=usr/local/bin/bash; echo ${A%/*}
usr/local/bin
π£ A=usr/local/bin/bash; echo ${A%%/*}
usr
v0.8.4
Supported ${name:offset:length}
Like this.
π£ A=hello
π£ echo ${A:1}
ello
π£ echo ${A:0:4}
hell
π£ B=γγγγγ
π£ echo ${B:4}
γ
π£ echo ${B:0:2}
γγ
v0.8.2
Supported +=
for variables
Here are examples.
π£ A=γγγγγ
π£ A+=γγγγγ
π£ echo $A
γγγγγγγγγγ
π£ A=(aaa)
π£ A+=(bbb ccc)
π£ echo ${A[@]}
aaa bbb ccc
caution
These behaviors of Bash are not simulated. The results may change on sush.
$ A=(aaa bbb)
$ A+=ccc
$ echo ${A[@]}
aaaccc bbb
$ B=aaa
$ B+=(bbb ccc)
$ echo ${B[@]}
aaa bbb ccc
v0.8.1
Supported complete -u
You can use user completion for commands after complete -u com1 com2 ...
.
π£ complete -u w
π£ w r<TAB>
root rtkit <- candidates
v0.8.0
Supported the test compound command [[ ]]
Though it is very complicated, we have implemented all of the options. If you find some problems, please tell us at the issue page.
complecated examples
### wildcards ###
π£ echo $-
i
π£ [[ $- == *i* ]] ;echo $?
0
π£ [[ *i* == $- ]] ;echo $?
1
### arithmetic operations ###
π£ [[ "1 + 2" -eq 3 ]] ;echo $?
0
π£ A=' 1 + 2 + 3 ' ; [[ $A -eq 6 ]] ; echo $?
0
π£ B=C ; C=' 1 + 2 + 3 ' ; [[ $B -eq 6 ]] ; echo $?
0
v0.7.6
Implemented short-circuit evaluation in arithmetic operation
As Bash does, this version does not evaluate the rightside of &&
or ||
when the result is fixed.
π£ B=0 ; echo $(( 0 || (B=2) )) ; echo $B
1
2 # B=2 is evaluated
π£ B=0 ; echo $(( 1 || (B=2) )) ; echo $B
1
0 # B=2 is not evaluated.
π£ B=0 ; echo $(( 0 && (B=2) )) ; echo $B
0
0
π£ B=0 ; echo $(( 1 && (B=2) )) ; echo $B
1
2