Anfaenger scripting

Florian Lohoff flo at rfc822.org
Sat Mar 2 10:44:09 CET 2002


On Sat, Mar 02, 2002 at 10:08:22AM +0100, Maik Holtkamp wrote:
> Hallo,
> 
> ich müsste alle Bilder in einem Verzeichnis in das Format
> image000.jpg bringen.
> 
> Versuch:
> 
> $X=0; for i in *; do cp $i "image$X.jpg"; X=`expr $X + 1` ; done
> 
> nummeriert zwar durch, aber verschluckt leider die führenden nullen
> bei 1 und 2 stelligen Werten.
> 

name=`printf "image%03d.jpg" $X`

flo at paradigm:~$ printf "image%03d.jpg" 3
image003.jpg

Flo
-- 
Florian Lohoff                  flo at rfc822.org             +49-5201-669912
Nine nineth on september the 9th              Welcome to the new billenium
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://lug-owl.de/pipermail/linux/attachments/20020302/a042c638/attachment.sig>


More information about the Linux mailing list