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

From "Chris F.A. Johnson" <chris@cfajohnson.com>
Newsgroups gnu.bash.bug
Subject Re: No support for spaces in for loop
Date 2015-08-18 18:55 -0400
Message-ID <mailman.8591.1439938553.904.bug-bash@gnu.org> (permalink)
References <55D3A2ED.4030302@gmail.com>

Show all headers | 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