diff options
author | 2012-02-28 15:22:55 +0800 | |
---|---|---|
committer | 2012-02-28 15:22:55 +0800 | |
commit | 565c53e2416f102a845e78b96360f6e39f5d1637 (patch) | |
tree | ecb0dde8ea0a8528adfe5cee0c012041319c3aa2 /scripts | |
parent | Parser&Walker: respect precedence in builtin test (diff) | |
download | libbash-565c53e2416f102a845e78b96360f6e39f5d1637.tar.gz libbash-565c53e2416f102a845e78b96360f6e39f5d1637.tar.bz2 libbash-565c53e2416f102a845e78b96360f6e39f5d1637.zip |
Parser&Walker: allow multiple arithmetic expressions
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/arithmetic_assignment.bash | 5 | ||||
-rw-r--r-- | scripts/command_execution.bash | 1 | ||||
-rw-r--r-- | scripts/compound_command.bash | 5 | ||||
-rw-r--r-- | scripts/var_def.bash | 4 | ||||
-rw-r--r-- | scripts/var_expansion.bash | 2 |
5 files changed, 16 insertions, 1 deletions
diff --git a/scripts/arithmetic_assignment.bash b/scripts/arithmetic_assignment.bash index 49f6751..d4e678e 100644 --- a/scripts/arithmetic_assignment.bash +++ b/scripts/arithmetic_assignment.bash @@ -23,4 +23,7 @@ d=2 e="1+2" echo $(($a + $b)) echo $(($a + $e)) - +(( a=1 )) +echo $a +(( a=(b=2,3) )) +echo $a $b diff --git a/scripts/command_execution.bash b/scripts/command_execution.bash index a10d229..e400409 100644 --- a/scripts/command_execution.bash +++ b/scripts/command_execution.bash @@ -78,3 +78,4 @@ o Hello\ echo \`\(\)\$\>\<\` export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}" > /dev/null +(( i=1, j=2)) && echo $i $j diff --git a/scripts/compound_command.bash b/scripts/compound_command.bash index ece5504..0db8ff8 100644 --- a/scripts/compound_command.bash +++ b/scripts/compound_command.bash @@ -351,3 +351,8 @@ case $target in ;; esac echo "case end" + +for((i=1,j=2;i!=2&&j!=4;++i)) +do + echo $i $j +done diff --git a/scripts/var_def.bash b/scripts/var_def.bash index 09c07c6..e757b16 100644 --- a/scripts/var_def.bash +++ b/scripts/var_def.bash @@ -31,6 +31,10 @@ echo ${ARRAY02[@]} ARRAY02[2]=4 ARRAY02[3]=5 echo ${ARRAY02[@]} +ARRAY02[3,2]=4 +echo ${ARRAY02[@]} +echo ${ARRAY02[2]} +echo ${ARRAY02[3]} EMPTY= echo $EMPTY PARTIAL[5]=5 diff --git a/scripts/var_expansion.bash b/scripts/var_expansion.bash index 9f442b1..5f0bfca 100644 --- a/scripts/var_expansion.bash +++ b/scripts/var_expansion.bash @@ -17,6 +17,8 @@ echo ${FOO009: -2} echo ${FOO009:100} echo ${FOO009: -100} echo ${FOO009:(-5 + 5)} +echo ${FOO009:(-5 + 5,0)} +echo ${FOO009:(-5 + 5,1)} echo ${NOT_EXIST:0} echo ${FOO009:0:2} echo ${FOO009:2:2} |