[Top][All Lists]

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

Re: printf question

From: Greg Wooledge
Subject: Re: printf question
Date: Tue, 12 Feb 2013 13:22:02 -0500
User-agent: Mutt/

On Tue, Feb 12, 2013 at 04:20:53AM -0800, laurent.testut@gmail.com wrote:
> > liste=`ls *.T02`

This is broken because filenames may contain spaces, newlines, etc.
Use an array instead:


See http://mywiki.wooledge.org/BashPitfalls for an explanation of some
of the issues.

This type of question is more appropriate for the help-bash mailing list,
by the way.

> 1> teqc.exe `ls *.T02` > out.T02
> 2> teqc.exe  $liste    > out.T02
> 3> teqc.exe "$liste"   > out.T02

All of those are wrong, each in its own way.

> What is the proper way of doing this ?

Well, the easiest way would be:

teqc.exe *.T02 > out.T02

If you insist on storing the filenames in advance for some reason, use
an array:

teqc.exe "${files[@]}" > out.T02

If you run into command line length issues, then you may have to process
the array in several chunks.  See http://mywiki.wooledge.org/BashFAQ/095
for examples of that.

reply via email to

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