Re: Bash: Save the "leading 0" in loops

Stefan Hundhammer <[email protected]>
Newsgroups gmane.linux.suse.programming
Organization SuSE Linux AG
Message-ID <[email protected]>
On Wednesday 17 November 2004 09:04, Oliver Leue wrote:
> for (i=001,i<701,i++); do echo name.$i.doc >> doc_index.txt
>
> With this the leading 0 get lost and the entries written as name.1.doc,
> name.10.doc,name.100.doc a.s.o.

Use printf (/usr/bin/printf or shell-builtin printf).


CU
-- 
Stefan Hundhammer <[email protected]>                Penguin by conviction.
YaST2 Development
SUSE Linux Products GmbH
Nuernberg, Germany

-- 
Um die Liste abzubestellen, schicken Sie eine Mail an:
    [email protected]
Um eine Liste aller verfügbaren Kommandos zu bekommen, schicken
Sie eine Mail an: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.