bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFE: brace expansion sequences should do zero padding


From: Eric Blake
Subject: Re: RFE: brace expansion sequences should do zero padding
Date: Mon, 03 Sep 2007 14:38:39 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Martin von Gagern on 9/3/2007 2:16 PM:
> 
> Another thing worth mentioning is negative numbers. My padding pads all
> numbers to a common width, not a common number of digits. This is what
> printf does, and it's a wee little bit easier to implement. However it
> could be changed to common number of digits as well. On IRC I got the
> idea that {-07..003} should do common width, whereas {-007..003} should
> do common number of digits. This, however, would add a lot of code. I
> think negative numbers are so rare that they are not worth the effort.
> Do you agree?

Perhaps rather than trying to improve bash {} expansion, you could use
coreutils seq instead.  For example,

$ seq -f 'a/%03g' -007 003
a/-07
a/-06
a/-05
a/-04
a/-03
a/-02
a/-01
a/000
a/001
a/002
a/003

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG3HDN84KuGfSFAYARAgLOAJ45Ksjc9I5AxFSUAICNGl+2M0q4IACgjz5m
uSXIlLY4d+bCCCc76LC9NCs=
=LJhV
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]