My new USRobotics Sportster Voice 56K Faxmodem

Gert Doering (gert@greenie.muc.de)
Fri, 17 Apr 1998 09:34:25 +0200


Hi,

Joseph Kwok wrote:
> Martin Fick wrote:
> > Try putting it in quotes when echoing it.
> >
> >    echo "$pages"
> >
> > Shells tend to treat non-quoted strings as lists.  List
> > elements are separated by a space or any other white
> > space.  When echoing without quotes, you get the list of
> > elements.  With quotes it's like a string.
> >
> > -Martin Fick
> 
> Yes, you are right.  It turns back to be in multiple lines.  Anyway, the
> faxspool line #810 in mgetty-1.1.12 was:
>     maxnr=`ls | wc -l tr -d " "`
> and this works fine.  But in mgetty-1.1.14, faxspool line #810 becomes:
>     maxnr=`echo $pages | wc -l | tr -d " "`
> That create the problem that the counting is wrong.  At least for my
> version of "echo".  Therefore, the recommended fix is either quoted the
> "$pages" or use wc -w instead.

Ok, I agree.  You have won (all of you), thanks for pointing that out.

I will change that to "wc -w", because that would work in all circumstances.

[The reason for my change in the first place was to avoid calling 'ls'
twice, if I have the number of pages available anyway, but I overlooked
the shell/echo behaviour Martin correctly analyzed].

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert@greenie.muc.de
fax: +49-89-35655025                        gert.doering@physik.tu-muenchen.de