Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11390

Re: No support for spaces in for loop

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail
From "Chris F.A. Johnson" <chris@cfajohnson.com>
Newsgroups gnu.bash.bug
Subject Re: No support for spaces in for loop
Date Tue, 18 Aug 2015 18:55:41 -0400 (EDT)
Lines 44
Approved bug-bash@gnu.org
Message-ID <mailman.8591.1439938553.904.bug-bash@gnu.org> (permalink)
References <55D3A2ED.4030302@gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type TEXT/PLAIN; charset=US-ASCII; format=flowed
X-Trace usenet.stanford.edu 1439938554 29384 208.118.235.17 (18 Aug 2015 22:55:54 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org
To Yan Pashkovsky <yanpaso@gmail.com>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=a0-2; h=Feedback-ID:X-Smtpcorp-Track:Message-ID:Subject:To: From:Date; bh=CEcZdxWRmwo2Tlu7VW9tBZ3AY0sQ0N6qt+9DhlOQa1M=; b=rKyarj5MtWt9K9Y N4ZXdpyxBHtb8rD9w+dSHXg8ZVH11uFG/iXqxsPR7ME3KQKuKuoqRmdK4OntK1GigrqXjhSpzZl4P UqUUwCszasV3CQGWCzr+Si0L79Qhe2apT36VT3bST+xAGaPAvMoWwTQPMJyQpo1Y0pm83Yx20J8WT knCznygTyEo8/skCjZRs0Zf0kCBIIZXJFFzIcjwAcCAtrkZQnDJU3fwUr3sFg1HWo+yMobdy5X9P0 vSAnSHFTCQtkFirF70keUv5mQe6+NbAMPvhXGTQoNKX24PGmWXhEuAJGhbs6+gZtPfigBc5cDslnp 1xZ9BIBrUnfblGuZ1pA==;
X-X-Sender chris@chris.tor
In-Reply-To <55D3A2ED.4030302@gmail.com>
User-Agent Alpine 2.10 (DEB 1266 2009-07-14)
X-Smtpcorp-Track 1ZRpnENRKF35ex.06fyodvDI
Feedback-ID 124612m:124612a-vpTX9:124612sqGtsmF9xo:SMTPCORP
X-Report-Abuse Please forward a copy of this message, including all headers, to <abuse@smtp2go.com>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 3.x
X-Received-From 216.22.15.234
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11390

Show key headers only | View raw


On Wed, 19 Aug 2015, Yan Pashkovsky wrote:

> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' 
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
> -DHAVE_CONFIG_H   -I.  -I../. -I.././include -I.././lib -D_FORTIFY_SOURCE=2 
> -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat 
> -Werror=format-security -Wall
> uname output: Linux mint-desktop 3.16.0-43-generic #58~14.04.1-Ubuntu SMP Mon 
> Jun 22 10:21:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 4.3
> Patch Level: 11
> Release Status: release
>
> Description:
>        "for file in *" doesn't correctly parse files containing spaces in 
> their filenames. For example file "an image of duck.jpg" will be interpreted 
> as 4 files "an" "image" "of" "duck.jpg"

   Yes, it does.

   Your problem is (probably, since you didn't include an example) that
   you omitted quotes around its expansion, e.g.:

printf '%s\n' $file

   That should be:

printf '%s\n' "$file"

> Repeat-By:
>
>
>

-- 
Chris F.A. Johnson, <http://cfajohnson.com>

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: No support for spaces in for loop "Chris F.A. Johnson" <chris@cfajohnson.com> - 2015-08-18 18:55 -0400

csiph-web