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.
The following is the here doc I am using. Most likely the tabs will be converted to spaces in this email. But the bottom line is, that while processing all the double tables, all the files in the current directory get listed, and the resultant file is all flush left, as if I had used the +EOF option:
Thing is, I thought I tested this previously, so it is possible that there is now something wrong in my environment causing the problem?
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
On 05/05/2017 02:40 PM, John R Pierce wrote:
On 5/5/2017 11:16 AM, Robert Moskowitz wrote:
But bash is ignoring tabs in my here docs.
tab in bash is indeed filename expansion. what are 'my here' docs ? not familiar with that phrase.
A *here document* is a special-purpose code block. It uses a form of I/O redirection to feed a command list to an interactive program or a command, such as ftp, cat, or the ex text editor.
Here Documents - The Linux Documentation Project http://tldp.org/LDP/abs/html/here-docs.html
tldp.org/LDP/abs/html/here-docs.html
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:
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@centos.org https://lists.centos.org/mailman/listinfo/centos
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 tried this on a Fedora system, and got the same problem, yet:
http://stackoverflow.com/documentation/bash/655/here-documents-and-here-stri...
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@centos.org https://lists.centos.org/mailman/listinfo/centos
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-stri...
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@centos.org https://lists.centos.org/mailman/listinfo/centos
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
On 5/5/2017 1:41 PM, Robert Moskowitz wrote:
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.
yes, bash interprets stdin differently than not stdin.
On 05/05/2017 04:46 PM, John R Pierce wrote:
On 5/5/2017 1:41 PM, Robert Moskowitz wrote:
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.
yes, bash interprets stdin differently than not stdin.
ARGH!!!
So can I control this? I want the howto to be a cut-n-paste operation. And I want to support real tabs not a bunch of spaces as I had previously...
On 5/5/17 1:52 PM, Robert Moskowitz wrote:
On 05/05/2017 04:46 PM, John R Pierce wrote:
On 5/5/2017 1:41 PM, Robert Moskowitz wrote:
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.
yes, bash interprets stdin differently than not stdin.
ARGH!!!
So can I control this? I want the howto to be a cut-n-paste operation. And I want to support real tabs not a bunch of spaces as I had previously...
Try cat <<- EOF
Note the dash. And yes, you must use tabs. Spaces are suppressed whereas tabs are not.
Jack
It's certainly possible to include tabs in here documents, in shell scripts it works as expected.
However, when you input the here document on the command line in an interactive shell, the moment you enter the tab it immediately triggers Bash' programmable completion and the tab never reaches the here document.
To disable programmable completion (temporarily), run: bind 'set disable-completion on' To (re-)enable programmable completion, run: bind 'set disable-completion off'
Robbert
On 05-05-17 20:16, 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.
The following is the here doc I am using. Most likely the tabs will be converted to spaces in this email. But the bottom line is, that while processing all the double tables, all the files in the current directory get listed, and the resultant file is all flush left, as if I had used the +EOF option:
Thing is, I thought I tested this previously, so it is possible that there is now something wrong in my environment causing the problem?
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 grantedve sh </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@centos.org https://lists.centos.org/mailman/listinfo/centos
Excellent!
On 05/05/2017 05:11 PM, Robbert Eggermont wrote:
It's certainly possible to include tabs in here documents, in shell scripts it works as expected.
However, when you input the here document on the command line in an interactive shell, the moment you enter the tab it immediately triggers Bash' programmable completion and the tab never reaches the here document.
To disable programmable completion (temporarily), run: bind 'set disable-completion on' To (re-)enable programmable completion, run: bind 'set disable-completion off'
This works just fine. Adds to all the sections where I have blocks with here documents with tabs, but better to turn it off and on each time, that assume it is in the right state.
Again, thanks.
Robbert
On 05-05-17 20:16, 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.
The following is the here doc I am using. Most likely the tabs will be converted to spaces in this email. But the bottom line is, that while processing all the double tables, all the files in the current directory get listed, and the resultant file is all flush left, as if I had used the +EOF option:
Thing is, I thought I tested this previously, so it is possible that there is now something wrong in my environment causing the problem?
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 grantedve sh </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@centos.org https://lists.centos.org/mailman/listinfo/centos
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos