Reg bash in cat


#1

Hi,

I ve been executing this code :
ssh.exec("cat > /home/bitscompress.sh <<‘EOF’

                   mv /var/www/magentodb.sql /var/www/Magentobits_V2
                   mv /var/www/wordpressdb.sql /var/www/Magentobits_V2
                   cp -R /var/www/wordpress /var/www/Magentobits_V2
                   cd /var/www
                   tar cvzf Magentobits_V2.tar.gz /var/www/Magentobits_V2  

EOF && /home/bitcompress.sh")

in ruby block resource.but it creates a file with eof loke this:
/home/bitscompress.sh

    mv /var/www/magentodb.sql /var/www/Magentobits_V2
                   mv /var/www/wordpressdb.sql /var/www/Magentobits_V2
                   cp -R /var/www/wordpress /var/www/Magentobits_V2
                   cd /var/www
                   tar cvzf Magentobits_V2.tar.gz /var/www/Magentobits_V2  

EOF && /home/bitcompress.sh

and showing the warning:
Recipe: trans::default
172.16.1.121
172.16.1.121 * ruby_block[Transfer bits] action run
172.16.1.121 bash: line 7: warning: here-document at line 0 delimited by end-of-file (wanted `EOF’)

Anyidea guys?

Thanks,
Indra


#2

You can’t have any extra characters on the line with the ending delimiter.

-Cam
On Aug 1, 2014 3:19 AM, “Indra k” indra.k@cloudenablers.com wrote:

Hi,

I ve been executing this code :
ssh.exec("cat > /home/bitscompress.sh <<‘EOF’

                   mv /var/www/magentodb.sql /var/www/Magentobits_V2
                   mv /var/www/wordpressdb.sql /var/www/Magentobits_V2
                   cp -R /var/www/wordpress /var/www/Magentobits_V2
                   cd /var/www
                   tar cvzf Magentobits_V2.tar.gz

/var/www/Magentobits_V2
EOF && /home/bitcompress.sh")

in ruby block resource.but it creates a file with eof loke this:
/home/bitscompress.sh

    mv /var/www/magentodb.sql /var/www/Magentobits_V2
                   mv /var/www/wordpressdb.sql /var/www/Magentobits_V2
                   cp -R /var/www/wordpress /var/www/Magentobits_V2
                   cd /var/www
                   tar cvzf Magentobits_V2.tar.gz

/var/www/Magentobits_V2
EOF && /home/bitcompress.sh

and showing the warning:
Recipe: trans::default
172.16.1.121
172.16.1.121 * ruby_block[Transfer bits] action run
172.16.1.121 bash: line 7: warning: here-document at line 0 delimited by
end-of-file (wanted `EOF’)

Anyidea guys?

Thanks,
Indra