2012-07-08 09:19:11 +08:00
|
|
|
# Test index ranges
|
|
|
|
|
2012-07-08 09:39:39 +08:00
|
|
|
echo Test variable expand
|
|
|
|
set n 10
|
|
|
|
set test (seq $n)
|
|
|
|
echo $test[1..$n] # normal range
|
|
|
|
echo $test[$n..1] # inverted range
|
2012-07-08 09:19:11 +08:00
|
|
|
echo $test[2..5 8..6] # several ranges
|
|
|
|
echo $test[-1..-2] # range with negative limits
|
|
|
|
echo $test[-1..1] # range with mixed limits
|
|
|
|
|
2012-07-08 09:39:39 +08:00
|
|
|
echo Test variable set
|
2012-07-08 09:19:11 +08:00
|
|
|
set test1 $test
|
2012-07-08 09:39:39 +08:00
|
|
|
set test1[-1..1] $test; echo $test1
|
|
|
|
set test1[1..$n] $test; echo $test1
|
|
|
|
set test1[$n..1] $test; echo $test1
|
|
|
|
set test1[2..4 -2..-4] $test1[4..2 -4..-2]; echo $test1
|
2012-07-08 09:19:11 +08:00
|
|
|
|
2012-07-08 09:39:39 +08:00
|
|
|
echo Test command substitution
|
2012-07-08 09:19:11 +08:00
|
|
|
echo (seq 5)[-1..1]
|
2012-07-08 09:39:39 +08:00
|
|
|
echo (seq $n)[3..5 -2..2]
|
2012-07-08 09:45:34 +08:00
|
|
|
|
|
|
|
echo Test more
|
|
|
|
echo $test[(count $test)..1]
|
|
|
|
echo $test[1..(count $test)]
|
2014-02-08 09:56:40 +08:00
|
|
|
|
|
|
|
# See issue 1061
|
|
|
|
echo "Verify that if statements swallow failure"
|
|
|
|
if false ; end ; echo $status
|