Page 1 of 1

batch file sending command to linux computer not working

Posted: 05 Sep 2015 09:39
by aristosv
I am running the following batch file, to make a modification in a file on a linux computer.

Code: Select all

plink.exe -ssh root@192.168.0.30 -pw password_here /bin/sed -i -e '/export s_sshhost="hostname1_here"/a export s_vpnhost="hostname2_here"' /file/to/edit/here


I get this message

Code: Select all

& was unexpected at this time


If I run this command directly on the Linux computer it works, so I know its not a problem with the command

Code: Select all

/bin/sed -i -e '/export s_sshhost="hostname1_here"/a export s_vpnhost="hostname2_here"' /file/to/edit/here


whats wrong with my batch file?

Thanks

Aristos

Re: batch file sending command to linux computer not working

Posted: 05 Sep 2015 09:51
by Aacini

Re: batch file sending command to linux computer not working

Posted: 05 Sep 2015 09:56
by aristosv
whats your point?

Re: batch file sending command to linux computer not working

Posted: 05 Sep 2015 10:05
by Squashman
aristosv wrote:whats your point?

The point is we want to be informed of all the help you are receiving for this problem so we do not duplicate solutions or waste our time helping when it has already been solved on a different forum.

Re: batch file sending command to linux computer not working

Posted: 05 Sep 2015 11:01
by aristosv
can you assist with the problem at hand?

Re: batch file sending command to linux computer not working

Posted: 05 Sep 2015 12:25
by Squashman
aristosv wrote:can you assist with the problem at hand?

Hard to when you are obfuscating the real command parameters you are executing. Batch files can choke for a lot of different reasons.

Re: batch file sending command to linux computer not working

Posted: 05 Sep 2015 23:02
by aristosv
Are you saying that I should provide the actual host names and the actual password?
In case there's something wrong with the host names or password, do you have a suggestion?

Re: batch file sending command to linux computer not working

Posted: 05 Sep 2015 23:24
by ShadowThief
To test if it's something with the hostname or password, just try

Code: Select all

plink.exe -ssh root@192.168.0.30 -pw password_here

by itself.