leading tabs in here-documents are always stripped even when they should not
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Here documents from the command line with tabs are not handled correctly. Here is a transcript showing the problem - there is a tab in front of "This is indented" in the file:
dzu@zarniwoop:~$ cat tab-test
#!/bin/bash
cat <<STOP
This is unindented
This is indented
STOP
dzu@zarniwoop:~$ bash tab-test
This is unindented
This is indented
dzu@zarniwoop:~$ echo "Now using mouse to copy&paste here-document"
Now using mouse to copy&paste here-document
dzu@zarniwoop:~$ cat <<STOP
> This is unindented
> This is indented
> STOP
This is unindented
This is indented
dzu@zarniwoop:~$
Dash handles this correctly:
dzu@zarniwoop:~$ dash
$ dash tab-test
This is unindented
This is indented
$ echo "Now using mouse to copy&paste here-document"
Now using mouse to copy&paste here-document
$ cat <<STOP
This is unindented
This is indented
STOP
> > > This is unindented
This is indented
$
The prompts in the dash output are suspicious but redirecting the output into a file yields correct output.
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: bash 4.4.18-2ubuntu1.2
ProcVersionSign
Uname: Linux 4.18.0-25-generic x86_64
NonfreeKernelMo
ApportVersion: 2.20.9-0ubuntu7.7
Architecture: amd64
CurrentDesktop: GNOME
Date: Fri Jul 19 11:45:27 2019
InstallationDate: Installed on 2019-05-28 (51 days ago)
InstallationMedia: Ubuntu 18.04.2 LTS "Bionic Beaver" - Release amd64 (20190210)
ProcEnviron:
TERM=xterm-
PATH=(custom, no user)
XDG_RUNTIME_
LANG=de_DE.UTF-8
SHELL=/bin/bash
SourcePackage: bash
UpgradeStatus: No upgrade log present (probably fresh install)