Re: [Nolug] spaces in environment variables conflicting with "echo"

From: Ron Johnson <ron.l.johnson_at_cox.net>
Date: 14 Apr 2003 18:31:09 -0500
Message-Id: <1050363068.3492.25.camel@haggis>

On Mon, 2003-04-14 at 17:12, Yuji Yamano wrote:
> Ron Johnson <ron.l.johnson@cox.net> writes:
>
> > $ ls -1 |grep ' '
> > foo bar
> > foo snafu
> > $
> > $ for f in `ls -1 |grep ' '`;
> > > do
> > > echo "$f";
> > > done
> > foo
> > bar
> > foo
> > snafu
> >
> >
> > Naturally, I don't want that!!! What's the magical sequence of
> > characters to get it to print out the complete file names?
>
> How about this? It works fine for me on Darwin.
>
> localhost% for f in "`ls | grep ' '`";
> for> do
> for> echo "$f"
> for> done
> foo bar
> foo snafu
> localhost%

Arigato. It never occurred to me to put dquotes around the ls/grep
command flow.

-- 
+-----------------------------------------------------------+
| Ron Johnson, Jr.     Home: ron.l.johnson@cox.net          |
| Jefferson, LA  USA   http://members.cox.net/ron.l.johnson |
|                                                           |
| An ad currently being run by the NEA (the US's biggest    |
| public school TEACHERS UNION) asks a teenager if he can   |
| find sodium and *chloride* in the periodic table of the   |
| elements.                                                 |
| And they wonder why people think public schools suck...   |
+-----------------------------------------------------------+
___________________
Nolug mailing list
nolug@nolug.org
Received on 04/14/03

This archive was generated by hypermail 2.2.0 : 12/19/08 EST