Skip to content

Releases: shellgei/rusty_bash

v0.9.7

14 Dec 02:35
Compare
Choose a tag to compare

Enabled to use associative arrays

like this:

🍣 declare -A X
🍣 X[abc]=123
🍣 X[def]=456
🍣 echo ${X[def]}
456
🍣 echo ${X[@]}
123 456
🍣 Y=abc
🍣 echo ${X[$Y]}
123

Enjoy!

v0.9.4

01 Dec 04:11
Compare
Choose a tag to compare

Implemented continue command

Like this:

### skip "echo NG" after the continue command ###
🍣 seq 2 | while read d ; do echo x; continue; echo NG ; done
x
x
### skip the outer loop with continue <num> ###
🍣 seq 2 | while read d ; do for a in a b ; do echo x; continue 2 ; done ; echo NG ; done
x
x

v0.9.2

20 Nov 11:21
Compare
Choose a tag to compare

Implemented some features

SECONDS, EPOCHSECONDS, EPOCHREALTIME

These variables are implemented by @t-koba .

  • SECONDS: time elapsed from the shell starts
  • EPOCHSECONDS: unixtime
  • EPOCHREALTIME: unixtime with microsecond
🍣 echo $SECONDS, $EPOCHSECONDS, $EPOCHREALTIME
2161, 1732101153, 1732101153.551434

enabled to use [0-9], [a-z], and [A-Z] in glob patterns

These wildcards are omitted in previous implementations.

🍣 ls
Cargo.lock  Cargo.toml  LICENSE  README.md  RELEASE.md  build.rs  src  target  test
🍣 ls [A-D]*
Cargo.lock  Cargo.toml
🍣 ls -d [!A-D]*
LICENSE  README.md  RELEASE.md  build.rs  src  target  test

v0.9.0

14 Nov 05:48
Compare
Choose a tag to compare

Fixed bugs on shell script execution

  • In the previous implemetation, we have used fd0 for reading shell scripts. This crude implementation has made fd0 unusable for reading data and has been the reasons of some errors.
  • core.tty_fd, which was duplicated from fd2, doesn't point tty if fd2 of a shell script was redirected to a file. This was a cause of bugs when a command is forked from the shell script. So core.tty_fd is duplicated from fd0 in this version.

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}
あい