Re: tabs ignored in here document

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



More research...


On 05/05/2017 04:35 PM, Robert Moskowitz wrote:


On 05/05/2017 03:33 PM, Bill Campbell wrote:
On Fri, May 05, 2017, Robert Moskowitz wrote:
I thought this worked.  Many web pages tell you it works.  But bash is
ignoring tabs in my here docs.  Worst, where there are two tabs, it is
functioning as a command expand in bash, where all files in the current
directory are listed to complete the command.

....

I suspect that the shell is attempting to expand the '*'
character.  You need to escape the delimiter with a backslash
to keep the shell from expanding:

I tried that earlier, and \EOF did not help. And I have env variables in the here doc I need replaced. If I had to SED the file as a second step, I would have. But like I said, \EOF did not make a difference.

I just did a test where I created a file, xit, with the here document in it and ran it with ./xit

This way, the tabs remained. So the 'problem' is when I am pasting the same lines (with tabs) into the terminal window. There bash is interpreting the tabs and not feeding them into the here doc processing.


I just tried this on a Fedora system, and got the same problem, yet:

http://stackoverflow.com/documentation/bash/655/here-documents-and-here-strings#t=201705051749422129426

Gives examples with tabs in it.  As does:

http://tldp.org/LDP/abs/html/here-docs.html

Oh, this is done through cut-n-paste. Cut from my web howto into a terminal window (screen usbtty into the Centos server). Is Terminal suppressing the tabs from the clipboard? I am using Xfce.



cat <<\EOF > 00-init.conf ...
...
EOF

cat <<EOF>00-init.conf || exit 1
ServerAdmin $admin_email
ServerName $your_host_tld
<VirtualHost *:80>
    <Directory "/var/www/html">
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>
<VirtualHost *:443>
    SSLEngine On
    SSLCertificateFile /etc/pki/tls/certs/$your_host_tld.crt
    SSLCertificateKeyFile /etc/pki/tls/private/$your_host_tld.key
    <Directory "/var/www/html">
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>
EOF

thanks

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux