bug-bash
[Top][All Lists]
Advanced

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

Spaces in args, escapes, and command substitution


From: bash
Subject: Spaces in args, escapes, and command substitution
Date: Tue, 24 Oct 2006 12:02:29 +1000

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib -D_GNU_SOURCE -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 
-march=i386 -mtune=pentium4 -fasynchronous-unwind-tables"
uname output: Linux XXX.zacglen.com 2.6.14-1.1644_FC4 #1 Wed Feb 22 11:11:16 
EST 2006 i686 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu

Bash Version: 3.0
Patch Level: 16
Release Status: release

Description:
    Inconsistent handling of escapes in command substitution.

Repeat-By:
    1. echo `echo a\\ b`
    2. echo $(echo a \\ b)

    In case 1) the result is plain "a b" (both escapes discarded)
    In case 2) the result is "a\ b" (the space is has single escape)

Fix:
    Can some attention be given to the problem of spaces in file names please?

    For example, "vi `grep -l *.c`" is fine so long as there are no spaces
    in the *.c filenames.  But if there are, then the split on space
    that command subsitution does messes everything up.

    Given that "grep -l" outputs newline-delimited result then surely there
    should it should be possibly to have the spaces on each line escaped
    and only the newlines converted to spaces.

    Perhaps quoted "$(command)" should properly escape spaces before converting
    newline to space, a little like quoted "$*" does.






reply via email to

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