shell: handle $((NUM++...) like bash does. Closes 10706
function old new delta evaluate_string 680 729 +49 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
		
							
								
								
									
										5
									
								
								shell/ash_test/ash-arith/arith-postinc.right
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								shell/ash_test/ash-arith/arith-postinc.right
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
1 1
 | 
			
		||||
1 1
 | 
			
		||||
1 1
 | 
			
		||||
1 1
 | 
			
		||||
Ok:0
 | 
			
		||||
							
								
								
									
										5
									
								
								shell/ash_test/ash-arith/arith-postinc.tests
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								shell/ash_test/ash-arith/arith-postinc.tests
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
echo 1 $((0++1))
 | 
			
		||||
echo 1 $((0--1))
 | 
			
		||||
x=-1; echo 1 $((0-$x))
 | 
			
		||||
x=+1; echo 1 $((0+$x))
 | 
			
		||||
echo Ok:$?
 | 
			
		||||
@@ -126,6 +126,10 @@ ghi
 | 
			
		||||
./arith2.sub: line 5: arithmetic syntax error
 | 
			
		||||
5 5
 | 
			
		||||
1 1
 | 
			
		||||
6 6
 | 
			
		||||
2 2
 | 
			
		||||
3 3
 | 
			
		||||
1 1
 | 
			
		||||
4 4
 | 
			
		||||
0 0
 | 
			
		||||
./arith2.sub: line 42: arithmetic syntax error
 | 
			
		||||
 
 | 
			
		||||
@@ -23,14 +23,14 @@
 | 
			
		||||
echo 5 $(( 4 + ++a ))
 | 
			
		||||
echo 1 $a
 | 
			
		||||
 | 
			
		||||
# ash doesn't handle it right...
 | 
			
		||||
#ash# echo 6 $(( 4+++a ))
 | 
			
		||||
#ash# echo 2 $a
 | 
			
		||||
# this is treated as 4 + ++a
 | 
			
		||||
echo 6 $(( 4+++a ))
 | 
			
		||||
echo 2 $a
 | 
			
		||||
      a=2
 | 
			
		||||
 | 
			
		||||
# ash doesn't handle it right...
 | 
			
		||||
#ash# echo 3 $(( 4---a ))
 | 
			
		||||
#ash# echo 1 $a
 | 
			
		||||
# this is treated as 4 - --a
 | 
			
		||||
echo 3 $(( 4---a ))
 | 
			
		||||
echo 1 $a
 | 
			
		||||
      a=1
 | 
			
		||||
 | 
			
		||||
echo 4 $(( 4 - -- a ))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user