Skip to content

Releases: shellgei/rusty_bash

v1.2.2

07 Sep 05:51
Compare
Choose a tag to compare

Compatibility Enhancements

This version additionally passed the test cases in test_fixed_v1.2.2.bash. Moreover, this version passed all of the cases in ifs-posix.tests, which is a test script in Bash official repo. It's amazing.

detalis

  • Fixed IFS problems
🍣 a=$'ab\001cd\001ef'; IFS=$'\001'; b=$'uv\177wx\177yz'; for w in ab${b}y${a}z ; do echo $w ; done
abuvwxyzyab
cd
efz
🍣 IFS=$' \t\n'
🍣 x=" a" ; set $x ; echo @$1@
@a@
🍣 IFS=": "; x=" a" ; set $x ; echo @$1@
@a@
🍣 IFS=": "; x=" a" ;echo @$x@
@ a@
🍣 IFS=$' \t\n'
  • Fixed set - problems
🍣 set x - ; echo $2
-
🍣 str="-"; set x $str ; echo $2
-
🍣 set "" ""; f() { echo $# ; } ; f "$@"
2
🍣 set "" ; f() { echo $# ; } ; f "$@"
1
🍣 set "" ; f() { echo $# ; } ; f "${@}"
1
  • Fixed bugs around arrays
🍣 c=(outside) ; f() { readonly c=(3) ; }; f; declare -p c
declare -ar c=([0]="3")
🍣 c=(outside) ; f() { readonly 'c=(3)' ; }; f; declare -p c
declare -ar c=([0]="(3)")
🍣 r=(1) ; f() { export r='(5)' ; }; f; declare -p r
declare -ax r=([0]="(5)")
  • Support printf %#x
🍣 printf "%#x\n" 12
0xc
🍣 printf "%#x\n" "'1"
0x31
🍣 printf "%#x\n" "'あ"
0x3042
🍣 tmp=$'\x7f'; printf "%#1x\n" "'$tmp"
0x7f
  • Fixed bugs of continue
🍣 for i in a b c; do echo $i; continue; echo bad-$i ; done; echo end-1
a
b
c
end-1
  • Fixed value check rules of braced variables
🍣 f() { echo "-${*-x}-" ; } ; f ""
--
🍣 echo F=~
F=/Users/ueda
🍣 echo ${A:-\a}
a
🍣 echo "${A:-\a}"
\a
🍣 echo ${A:-~}
/Users/ueda
🍣 echo "${A:-~}"
🍣 : ${A:=~}; echo $A
/Users/ueda
🍣 : ${A:=~:aa}; echo $A
/Users/ueda
🍣 : ${A:=~/bin:~/bin2}; echo $A
/Users/ueda
🍣 : ${A:=B=~/bin:~/bin2}; echo $A
/Users/ueda
🍣 B=aaa;C=D=~/bin:$B; echo $C
D=~/bin:aaa
  • Fixed tilde expansion rules in here-documents
🍣 cat << EOF
> ~
> EOF
~
🍣 cat << EOF
> ~/bin
> EOF
~/bin

Full Changelog: v1.2.1...v1.2.2

v1.2.1

12 Aug 07:30
Compare
Choose a tag to compare

Fixes around arrays and associative arrays and implementation of some features

We (four contributors!) have enhanced and revised various features. You can see the test script for v1.2.1 on https://github.com/shellgei/rusty_bash_test/blob/v1.2.1/test_fixed.bash .

support of >() (halfway)

🍣 echo 123 | tee >(rev) >(fold -b1) -
123
1
2
3
321
### issue: not yet connected to the subsequent pipe ###
🍣 echo 123 | tee >(rev) >(fold -b1) - | rev
1
2
3
321
321
γ€€γ€€γ€€γ€€γ€€γ€€γ€€#stopping here
γ€€
^CPid: Pid(15326), Signal: SIGINT

fixes around arrays and associative arrays

  • support of element append on associative arrays
🍣 declare -A a=( [i]=abc ) ; a+=( [i]+=def ); declare -p a
declare -A a=([i]="abcdef" )
  • support of integer mode on associative arrays

multi-language support by @LinuxBoy-96

$ LANG=ja_JP.UTF8 sush 
Homebrew Bash completions do not work in POSIX mode
Sushi shell (a.k.a. Sush), バージョン 1.2.1 - release
🍣 exit
$ LANG=ar_AR.UTF8 sush 
Homebrew Bash completions do not work in POSIX mode
Sushi shell (a.k.a. Sush), Ψ₯Ψ΅Ψ―Ψ§Ψ± 1.2.1 - release
🍣 

others

  • fixes for Android by @YumeYuka
  • fixes based on clippy warnings by @t-koba
  • implementation of declare -u
  • implement of ulimit (halfway)
  • implement of @k, @K, @Q for parameters
🍣 a=abc ; echo ${a@k}
'abc'
🍣 A=(a b) ; echo "${A[@]@K}"
0 "a" 1 "b"
🍣 A=(a b) ; echo "${A[@]@Q}"
'a' 'b'

merged pull requests

change log

Full Changelog: v1.2.0...v1.2.1

Thank you for all users and contributers!

v1.2.0

20 Jul 04:47
Compare
Choose a tag to compare

Enhanced Compatibility around Variables and Parameters

We have fixed subtle different behaviors between Bash and Sush mainly based on the run-array script in https://github.com/ryuichiueda/bash_for_sush_test/tree/master/tests . We can see the added test cases for this version from v1.1.8 in https://github.com/shellgei/rusty_bash_test/blob/v1.2.0/test_fixed.bash .

  • supported declare -f
  • fixed the difference between Bash and Sush on the handlings of arrays and associative arrays
    • I can't explain these very subtle fixes. Please see the cases in the URL indicated above.
  • fixed out put of declare -p

Full Changelog: v1.1.8...v1.2.0

v1.1.8

09 Jun 06:15
Compare
Choose a tag to compare

Improvement of compatibility to Bash

We add various features and bug fixes to this version from v1.1.6. Added test cases are as follows:

What's Changed

  • Added support for Android platform by @YumeYuka in #143
  • Enabled to apply the integer mode to arrays and associative arrays
  • Fixed some bugs around IFS
  • Enabled to read a value to an element of an array
### an example ###
🍣 read hoge[1] <<< abc
🍣 echo ${hoge[1]}
  • Enabled to use unset toward an array element
  • Considered ${a[ ]} as ${a[0]}
  • Enabled to show the list of traps with trap command
  • Supported options
    • -a option (auto export of variables)
    • -C option (protection of files at redirects)
    • execfail
    • lastpipe
  • Fixed single quoting rule on the value check of double quoted braced parameters
$ echo "${A-'"""'hey}"
''hey
$ echo "${A-'"\"'hey}"
'"'hey
$ echo "${A-'"aa"'hey}"
'aa'hey
  • Fixed eval and let commands

New Contributors

Full Changelog: v1.1.6...v1.1.8

v1.1.6

16 May 02:02
Compare
Choose a tag to compare

Improvement of Job Control

Job control and some features are added to this shell. See additional test cases between v1.1.5 and v1.1.6 in our test.

The number of passed test scripts (run-***) in Bash repo increased from 15 to 20.

additions and corrections

  • addition of disown, kill, and hash commands
  • implementation of behaviors of wait at -n option
🍣 sleep 10 &
16279
🍣 wait -p a -n %%
🍣 echo $a
16279
  • enabled to set a pid to a variable with wait
  • tilde expansions after = and :
🍣 echo A=~/:~/:~/
A=/home/ueda/:/home/ueda/:/home/ueda/
  • enabled to use a jobspec lika a command
🍣 sleep 10 &
16110
🍣 %%
sleep 10
  • fixed behavior of the shell at definition/use of aliases
### examples ###
🍣 alias a='echo A'
🍣 a a
A a
🍣 alias a='echo A '
🍣 a a
A echo A
🍣 alias a='echo abc \'
🍣 a|rev
abc |rev
🍣 a |rev
  cba

Full Changelog: v1.1.5...v1.1.6

v1.1.5

07 May 07:15
Compare
Choose a tag to compare

Compatibility improvement

We add some features to this shell and fix some incompatible behaviors based on the test in official Bash repo. See additional test cases between v1.1.4 and v1.1.5 in our test.

  • Fixed the behavior of our shell when it is feeded a shell script containing lines that should be read by a command in the shell script.
### example ###
🍣 echo 'cat
> This line is read by the above cat' | sush
This line is read by the above cat
  • Invalidate ANSI-C quoting in here documents
  • Implemented substitutions for every element in an array
### example ###
🍣 set abc abc; echo ${*/a/A}
Abc Abc
  • Enabled to parse $"..." (roughly)
  • Enabled to use declare -r for an element of an array

Full Changelog: v1.1.4...v1.1.5

v1.1.4

20 Apr 00:24
Compare
Choose a tag to compare

Compatibility improvement

  • Supported the followings
    • Initialization of arrays or associative arrays with indexes (e.g. A=([4]=hato [1]=yaha [2]=yoi [6]=furo) )
    • Enabled to use $! (PID of the latest background job)
    • Support of the empty blacket [] on file glob
    • Immediate abort of a case command at an error of arithmetic expansion in a pattern
    • Improvement of IFS compatibility when $* is used
    • Support of the heredocument with <<-
    • Fix of getopts when it is used in a function

other important change

The test scripts under test were relocated to another repository because they contains test cases derived from the Bash repository licenced under GPL.

  • The test cases added for this version can be seen in this file.

Full Changelog: v1.1.3...v1.1.4

v1.1.3

13 Apr 04:42
Compare
Choose a tag to compare

Fixed terrible bugs

I'm extremely sorry. That's terrible.

solved calculation problem

The implementation of arithmetic expressions in v1.1.2 has passed all of the tests in Bash repo. However, it mistook the following simple calculation. That is because the calculation was evaluated from the right side, ... and because our repo and Bash repo missed such an easy test case.

### It's wrong. (terrible) ###
🍣 echo $(( 1 - 2 + 3 ))
0

We now fixed and the shell keeps a correct tally.

### calculated from the left side ###
🍣 echo $((1 - 2 + 3))
2
### It must be evaluated from the right side in this case. ###
🍣 a=3 b=3 c=3
🍣 echo $(( a += b += c ))
9
🍣 echo $a $b $c
9 6 3

solved an input mixing problem on source command

It's also terrible. The following is the behavior of v1.1.2.

### test.bash ###
echo OK | ( while read line ; do echo $line ; done )
ああああああ!
🍣 source test.bash 2> /dev/null
ああああああ!      # <- the read command reads the next line of test.bash
OK

It's fixed at v1.1.3.

source test.bash 2> /dev/null
OK

Full Changelog: v1.1.2...v1.1.3

v1.1.2-beta

12 Apr 00:24
Compare
Choose a tag to compare

Compatibility Improvements around arithmetic expression, and others

Based on the test in Bash repository, outputs are matched to those of Bash.

Examples

🍣 n=0 a="(a[n]=++n)<7&&a[0]"; ((a[0])); echo "${a[@]}"
(a[n]=++n)<7&&a[0] 1 2 3 4 5 6 7
🍣 unset a
🍣 a=1 ; a[1]=2 ; echo ${a[@]}
1 2
🍣 PARAM=abcdefg; echo ${PARAM:1 ? 4 : 2}
efg
🍣 unset a
🍣 A="a[0]" ;echo $(( ++$A))
1
🍣 a=1 ; echo $((4+ + +a))
5
🍣 a=1 ; echo $((4+ ++a))
6
🍣 a=1 ; echo $((4+++a))
6

other improvement

  • support of globskipdots
  • support of REPLY
  • support of read -n
  • support of %u, %o, %i on printf
  • support of declare -i

Full Changelog: v1.1.0...v1.1.2

v1.1.0-beta

02 Apr 00:27
Compare
Choose a tag to compare

Additional implementation

  • Addition on printf command
    • added "%x", "%X" as the formatter
    • fixed behavior of "%q"
    • enabled to repeatedly output when arguments are more than formatters
    • support of format by number on "%d", "%s", "%X" (e.g. "%010d")
  • Implementation of let command
  • Support of definition of functions without () when function keyword is used
  • Implementation of (nearly) accurate behavior of read and set toward IFS
  • Enable to refer positional parameters after ${10}
  • Implementation of globstar

Full Changelog: v1.0.8...v1.1.0