Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can't find string terminator

2,241 views
Skip to first unread message

Alvin Ramos

unread,
May 9, 2012, 10:02:00 PM5/9/12
to begi...@perl.org
Have a simple perl script that will run a mysql dump, but I'm getting

Can't find string terminator '"' anywhere before EOF at ./ssh.pl line 5

My code, I assume the " is throwing it all off, but the / didn't help:

use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new("heaven.theflux.net");
$ssh->login("root", "temp");
$ssh->cmd("mysqldump -uroot -pnew-password -t -T/var/lib/mysql free
ExData --fields-enclosed-by=\"\ --fields-terminated-by=\|\");

Thank you for any and all assistance!

Regards,
Al

Michael Brader

unread,
May 9, 2012, 10:40:47 PM5/9/12
to begi...@perl.org
The error is telling you exactly what the problem is, your final terminator
is missing (because you've quoted it). To save you all that backwhacking,
consider using qq:

$ssh->cmd( qq{mysqldump -uroot -pnew-password -t -T/var/lib/mysql free
ExData --fields-enclosed-by=" --fields-terminated-by=|} );

Read 'perldoc perlop' for more information on qq.

Depending on how Net::SSH::Perl handles the argument to cmd, you may still
need to quote the double quote and pipe symbols:

$ssh->cmd( qq{mysqldump -uroot -pnew-password -t -T/var/lib/mysql free
ExData --fields-enclosed-by='"' --fields-terminated-by='|'} );

Cheers,
Michael
--
Michael Brader
Senior Software Engineer - Billing
Techops - Softdev
Internode http://www.internode.on.net/

Owen

unread,
May 9, 2012, 10:44:50 PM5/9/12
to Alvin Ramos, begi...@perl.org
On Wed, 9 May 2012 22:02:00 -0400
Alvin Ramos <w...@theflux.net> wrote:

> Have a simple perl script that will run a mysql dump, but I'm getting
>
> Can't find string terminator '"' anywhere before EOF at ./ssh.pl line
> 5
>
> My code, I assume the " is throwing it all off, but the / didn't help:
>
> use Net::SSH::Perl;
> my $ssh = Net::SSH::Perl->new("heaven.theflux.net");
> $ssh->login("root", "temp");



Look at this section

> $ssh->cmd("mysqldump -uroot -pnew-password -t -T/var/lib/mysql
> free ExData --fields-enclosed-by=\"\ --fields-terminated-by=\|\");


Count the ". One way or the other, the parser cannot find a matching "



--


Owen

Alvin Ramos

unread,
May 10, 2012, 12:35:39 PM5/10/12
to Owen, begi...@perl.org
Thanks for your help "qq{mysqldump ..." worked perfectly!
0 new messages