bug-bash
[Top][All Lists]
Advanced

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

Word-splitting with here document?


From: Clint Hepner
Subject: Word-splitting with here document?
Date: Wed, 2 Sep 2015 14:14:24 -0400

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: darwin13.4.0
Compiler: clang
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='darwin13.4.0' -DCONF_MACHTYPE='x86_64-apple-darwin13.4.0' -DCONF_VENDOR='apple' -DLOCALEDIR='/usr/local/Cellar/bash/4.3.30/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DMACOSX   -I.  -I. -I./include -I./lib -I./lib/intl -I/private/tmp/bash-tugB48/bash-4.3/lib/intl  -DSSH_SOURCE_BASHRC
uname output: Darwin patikoija 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Machine Type: x86_64-apple-darwin13.4.0

Bash Version: 4.3
Patch Level: 30
Release Status: release

Description:
       Unexpected word splitting in here string. According to the man page, "Pathname  expansion and word splitting are not performed." This is essentially the same wording used to explain how `[[...]]` treats its contents, but the here string seems to behave differently.

Repeat-By:

       $ x="foo        bar"
       $ [[ $x == "foo        bar" ]]  # succeeds, no word splitting on value of x
       $ cat <<< $x     # Word-splitting appears to collapse the run of whitespace
       foo bar
       $ cat <<< "$x"  # Whitespace preserved, as with here doc
       foo     bar


reply via email to

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