I use Windows 10 home (build 16299.248) and I'm SSHing into a remote Ubuntu 16.04 machine with various SSH clients (like Putty/MobaXterm).
I copy-paste the following code from my personal GitHub account into an SSH session:
cat <<-EOF >> "$HOME"/.bashrc
export s_a="/etc/nginx/sites-available"
export s_e="/etc/nginx/sites-enabled"
export drt="/var/www/html"
source "$HOME"/"$repo"/software_internal.sh
EOF
I copy it directly from my GitHub account here (non-raw version) although the following problem happens even if I copy from GitHub raw version.
My problem
The result in the remote Bash is this:
> .export s_a="/etc/nginx/sites-available"
> .export s_e="/etc/nginx/sites-enabled"
> .export drt="/var/www/html"
> .source "$HOME"/"$repo"/software_internal.sh
> EOF
Note the single dot in the start of almost each line.
Something is translating tabulations into single dots.
Facts
The problem I just described happens with various types of SSH clients.
People were also able to replicate the problem in Linux systems (Debian, Ubuntu), moreover, if I use Windows 10 Subsystem for Linux (WSL) I don't have the dots (whether from Powershell or CMD). I also don't use Pasteboard / clipboard managers of any kind in Windows 10.
There's also no evidence that GitHub is using any nonconventional tab character.
It happens when I copy either from Mozilla Firefox or Google Chrome.
I didn't change anything in the DigitalOcean Ubuntu Bash after installing it (after creating my "droplet" in the DigitalOcean terminology).
This seems to be a bug in GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
. I was able to replicate the bug In Debian stable 9.3 with Bash 5.2 as well. Yet this problem dosen't happen in Arch, so it's likely to be unique to Debian distributions.
Further information
The problem happens not only in DigitalOcean but in Linode as well - a Linode engineer was able to reproduce this in Ubuntu 14.04, 16.04, and 17.04.
It is possible that DigitalOcean and Linode customize Ubuntu the same way and the bug is not in Bash but still unique to DigitalOcean and Linode.
Summary
The above problem is extremely unlikely to come from either Windows 10, SSH clients, GitHub GUI, or web browsers; It is likely to come either from Debian repositories, Bash in 4.3 / 5.2 / other, or the combination of Debian-Bash.
My question
What is the right way to cope with this problem? I could of course delete the heredocument tabs, but it's definitely something I don't want. The tabs help me to better organize the heredocument.