Bash Version: 4.0
Patch Level: 35
Release Status: release
Description:
[Detailed description of the problem, suggestion, or complaint.]
The command substitution reduce spaces even in strings.
This is not healthy on copying files of which names containing double or
more spaces generated by command substitution.
Short example:
$ echo $(echo "'alfa beta'")
'alfa beta'
Instead of 'alfa beta' with double space.
Repeat-By:
[Describe the sequence of events that causes the problem
to occur.]
$ echo $(echo "'alfa beta'")
'alfa beta'
Instead of 'alfa beta' with double space.
> Configuration Information [Automatically generated, do not change]:
> Machine: i686
> OS: linux-gnu
> Compiler: i686-pc-linux-gnu-gcc
> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' -DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin' -DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -O2 -march=athlon-mp -pipe
> uname output: Linux fiz15.jupiter.vein.hu 2.6.30-gentoo-r8 #1 SMP Thu Nov 12 16:15:30 CET 2009 i686 AMD Athlon(tm) MP 2000+ AuthenticAMD GNU/Linux
> Machine Type: i686-pc-linux-gnu
>
> Bash Version: 4.0
> Patch Level: 35
> Release Status: release
>
> Description:
> [Detailed description of the problem, suggestion, or complaint.]
>
> The command substitution reduce spaces even in strings.
> This is not healthy on copying files of which names containing double or
> more spaces generated by command substitution.
> Short example:
>
> $ echo $(echo "'alfa beta'")
> 'alfa beta'
>
> Instead of 'alfa beta' with double space.
>
> Repeat-By:
> [Describe the sequence of events that causes the problem
> to occur.]
>
>
> $ echo $(echo "'alfa beta'")
> 'alfa beta'
>
> Instead of 'alfa beta' with double space.
>
>
Hello all.
Use more quotes, like:
echo "$(echo "'alfa beta'")"
Regards,
Matias
> $ echo $(echo "'alfa beta'")
> 'alfa beta'
>
> Instead of 'alfa beta' with double space.
Always try tracing to understand what is going on:
echo $(set -x ;echo "'alfa beta'")
++ echo ''\''alfa beta'\'''
http://www.mpi-inf.mpg.de/~uwe/lehre/unixffb/quoting-guide.html