Releases: shellgei/rusty_bash
Releases Β· shellgei/rusty_bash
v0.7.5
Supported the test compound command [[ ]] and file check options
-a, -b , -c, -d, -e, -f, -g, -h, -k, -p, -r, -s, -t, -u, -w, -G, -L, -N, -O, -S are available in [[ ]].
This is an example.
π£ [[ -a /etc/passwd ]] ; echo $?
0
π£ [[ -a /etc/passwdaaa ]] ; echo $?
1
The meanings of options can be seen in the CONDITIONAL EXPRESSIONS part of man bash
.
v0.7.3
Supported -c option
Like this.
$ sush -c 'echo HELLO WORLD'
HELLO WORLD
v0.7.1
Enabled to read and execute shell scripts
We can use shell scripts with shebang from this version. The output with -v is also fixed as it becomes identical with that of Bash.
example
### example shell script ###
π£ cat ~/tmp/hoge.sush
#!/bin/sush -xv # Change the path if necessary
echo abc
echo d\
ef
echo $LINENO
using the script with shebang
π£ ~/tmp/hoge.sush
#!/bin/sush -xv
echo abc
+ echo abc
abc
echo d\
ef
+ echo def
def
echo $LINENO
+ echo 8
8
using the script without shebang
π£ sush ~/tmp/hoge.sush
abc
def
8
π£ sush ~/tmp/hoge.sush -xv
#!/bin/sush -xv
echo abc
+ echo abc
abc
echo d\
ef
+ echo def
def
echo $LINENO
+ echo 8
8
v0.7.0
Supported Zsh like n-digit output
Here are the examples:
π£ echo $(( [#2] 1000 + 23 ))
2#1111111111
π£ echo $(( [#8] 1000 + 23 ))
8#1777
π£ A=2#11111110 ; echo $(( [#16] A ))
16#FE
v0.6.8
Supported "for command"
### example 1 ###
π£ for n in A B C ; do echo $n ; done
A
B
C
### example 2 ###
π£ set one two three
π£ for n ; do echo $n ;done
one
two
three
### example 3 ###
π£ for ((n=0;n<3;n++)) ; do echo $n ;done
0
1
2
v0.6.7
Supported floating operation
It may be helpful for some people.
π£ echo $(( 1.0 / 2 ))
0.5
π£ echo $(( 1 / 2 ))
0
π£ A=1.1 ; echo $(( A*3 ))
3.3000000000000003
π£ echo $(( 1.1**1.1 ))
1.1105342410545758
Enjoy.
v0.6.6
Support n-digit numbers (2 <= n <= 64)
Examples:
π£ echo $(( 64#@ )) $(( 64#_ ))
62 63
π£ echo $(( 2#11 + 2#01 ))
4
π£ echo $(( 010 ))
8
π£ echo $(( 0xA )) $(( 0Xa ))
10 10
π£ echo $(( 64#WTF ))
241129
v0.6.5
Support of the compound command (( ))
π£ (( 0 ))
π£ echo $?
1
π£ (( 1 ))
π£ echo $?
0
π£ (( 1 + 2 + 3 + 4 - 10 ))
π£ echo $?
1
π£ A=0 ; (( A )) || echo "A is FALSE"
A is FALSE
π£ A=-1 ; (( A )) && echo "A is TRUE"
A is TRUE
v0.6.4
Finshed implementation of operations in arithmetic expansion
Followings are the examples of additional part from v0.6.3:
π£ echo $(( A=10 , ++A ))
11
π£ echo $(( B=1 , A= B ? 1 : 2 ))
1
π£ echo $(( B=-1 , B+=1 , A= B ? 1 : 2 ))
2
v0.6.3
Supported !
, ~
, <<
, >>
, <=
, >=
, <
, >
, ==
, !=
, &
, ^
, |
, &&
and ||
in $(( ))
See the chapter ARITHMETIC EVALUATION in man bash
for detail. I'm tired.