bug-bash
[Top][All Lists]
Advanced

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

Re: for ... in ... do ignores escape characters


From: Paul Jarc
Subject: Re: for ... in ... do ignores escape characters
Date: Thu, 17 Apr 2008 20:46:39 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

luiscolorado <address@hidden> wrote:
> This is what I get when some file names have spaces:
>
> for i in `my-program`
> do
> echo $i
> done
>
> It echoes the following:
>
> sony
> apple
> hewlett 
> packard

Unquoted `` expansions are split into words using $IFS.  So if you
only want to split on newlines:
old_ifs="$IFS"
IFS='
'
for i in `my-program`; do ...; done
IFS="$old_ifs"


paul




reply via email to

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