Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: padding.
- X-seq: zsh-users 22444
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Subject: Re: padding.
- Date: Sat, 11 Feb 2017 06:29:06 +0000
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=32GF/gsmhCqYXpx 7qAqbwf9vnVQ=; b=Zw/4PwdpEWD5SvhSj0EItXbXsmi/LDi3jAAzBPAaYkUiCVy rl1Ij1ULau38MhlUixfV4iI0b3PaYnSXsuxEk2w79Lhh8sFqbBzJSOHo6lb5BByL qtu+4sDCW+tmqVq//zovKJ3CU3Lhinhu5G1u79x3tw7Jcf6Tz5tiAHolM4d8=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=32GF/gsmhCqYXp x7qAqbwf9vnVQ=; b=T5DPm9gkcHDEr+vxgNVS+bgVobL35EOF25BzdWU03BbsEw NWArQDceC6/i1GxYBzCyv1yQsy1aw8rx3ai8KEVX9OVZ6VEFy+hKUv7L32B6YbUS DmCGuYejcT7+BfPTzmMN9urM3/W5ne7OtugqhOAsIfvRq4I247Bn5PQGmkhAA=
- In-reply-to: <0befdb38-eaa5-6388-a3fe-58b1a73834b7__26816.8318471455$1486784821$gmane$org@eastlink.ca>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <0befdb38-eaa5-6388-a3fe-58b1a73834b7__26816.8318471455$1486784821$gmane$org@eastlink.ca>
Ray Andrews wrote on Fri, Feb 10, 2017 at 19:15:14 -0800:
> $ integer -x vvar=-1
> $ echo ${(l:5::0:)vvar}
>
>
> 000-1
>
>
> How do I get "-00005"? But also with the negative not counting as part of
> the padding? Or is this a job for printf? It seems to be asking quite a
> bit from zsh itself.
${(l)} is a string operator:
% integer x
% echo ${(l:5::x:)x}
xxxx0
So, yes, use printf %05d.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author