[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Brace expansion padding inconsistencies
From: |
gregry . |
Subject: |
Brace expansion padding inconsistencies |
Date: |
Wed, 10 Aug 2011 13:43:11 -0700 (PDT) |
Brace expansion using incrementers sometimes produces unexpected results with
regard to padding.
Note the following 4 examples not using incrementers:
bash> echo {0..9}
0 1 2 3 4 5 6 7 8 9
bash> echo {00..9}
00 01 02 03 04 05 06 07 08 09
bash> echo {0..09}
00 01 02 03 04 05 06 07 08 09
bash> echo {00..09}
00 01 02 03 04 05 06 07 08 09
All of the results above are as expected.
Now note these similar expansions with incrementers added:
bash> echo {0..9..2}
0 2 4 6 8
bash> echo {00..9..2}
00 02 04 06 08
bash> echo {0..09..2}
00000 00002 00004 00006 00008
bash> echo {00..09..2}
00000 00002 00004 00006 00008
The first two are as expected, but the last two have unexpected additional
padding.
These examples were using:
bash> bash --version
GNU bash, version 4.0.35(1)-release (i586-suse-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
- Brace expansion padding inconsistencies,
gregry . <=