diff options
author | maxfl <gmaxfl@gmail.com> | 2012-07-08 09:39:39 +0800 |
---|---|---|
committer | maxfl <gmaxfl@gmail.com> | 2012-07-08 09:39:39 +0800 |
commit | e1b8c425da571b7f002103805520a1d496ebb087 (patch) | |
tree | f4a9790adc9ba61f3485e0013b6f958f80a14695 /tests/test8.in | |
parent | 5f05756e657d85026026d95d4ada0b6677861900 (diff) |
Fix case when second limit is a variable:
echo $PATH[1..$n]
Diffstat (limited to 'tests/test8.in')
-rw-r--r-- | tests/test8.in | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/test8.in b/tests/test8.in index e03d9d05..3a76e8bf 100644 --- a/tests/test8.in +++ b/tests/test8.in @@ -1,21 +1,21 @@ # Test index ranges -# Test variable expand -set test (seq 10) -echo $test[1..10] # normal range -echo $test[10..1] # inverted range +echo Test variable expand +set n 10 +set test (seq $n) +echo $test[1..$n] # normal range +echo $test[$n..1] # inverted range echo $test[2..5 8..6] # several ranges echo $test[-1..-2] # range with negative limits echo $test[-1..1] # range with mixed limits -# Test variable set +echo Test variable set set test1 $test -set test1[-1..1] $test # reverse variable -echo $echo $test1 -set test1[2..4 -2..-4] $test1[4..2 -4..-2] -echo $test1 +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 -# Test command substitution +echo Test command substitution echo (seq 5)[-1..1] -echo (seq 10)[3..5 -2..2] - +echo (seq $n)[3..5 -2..2] |