Skip to content

Releases: shellgei/rusty_bash

v0.8.11

10 Nov 12:04
Compare
Choose a tag to compare

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

10 Nov 06:54
Compare
Choose a tag to compare

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

04 Nov 23:33
Compare
Choose a tag to compare

Supported RANDOM

🍣 echo $RANDOM
28778
🍣 echo $RANDOM
22003
🍣 echo $RANDOM
7483

v0.8.7

26 Oct 01:06
Compare
Choose a tag to compare

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

23 Oct 07:13
Compare
Choose a tag to compare

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

22 Oct 07:05
Compare
Choose a tag to compare

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

20 Oct 04:31
Compare
Choose a tag to compare

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

20 Oct 03:49
Compare
Choose a tag to compare

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

19 Oct 04:57
Compare
Choose a tag to compare

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

15 Sep 04:52
Compare
Choose a tag to compare

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