[NTLUG:Discuss] bash question

R P Herrold herrold at owlriver.com
Wed Sep 12 17:17:56 CDT 2001


On Wed, 12 Sep 2001, Steve Baker wrote:

> > for i in ` ls *.pdf | tr ' ' '_'`; do
> >         DONAME=`basename $i .pdf`
> >         pdftotext $DONAME.pdf $DONAME.txt
>
> Finally (and here is where the bug is), it runs:
> ...which is **WRONG** because there is no such file as a_b_c.pdf,
> we only have "a b c.pdf".

Good catch -- I had just 'desk-checked', and did not live
test, as I noted --

I would probably have ended up at the 'embeded in
double-quotes' solution, but some 'backslash' hiding of
double-quotes is often needed in backtick expressions.

>From an admin's point-of-view, the best solution is for users
not to use the embeded spaces -- but Mac and Windows have
fostered this [darn end users <grin>] ...

-- Russ




More information about the Discuss mailing list