0

I am trying to execute a remote command on a OVMS server using plink. When I try executing a simple command its working fine:

plink -ssh -l USERID HOST-pw PASSWORD DIR

But when i start using some complex command it is throwing error:

plink -ssh -l USERID HOST-pw PASSWORD wnb search/keys="TRN|0567 6789"/log/sys

Please suggest.

Hein
  • 1,453
  • 8
  • 8
  • plink aka PuTTY Link, a command-line connection tool similar to ssh? Without knowing anything about the thrown error it is difficult to suggest anything. Usually, this is a quoting problem. Did you try to quote the VMS command (which requires to escape the inner quotes)? – user2116290 Sep 02 '14 at 17:45
  • Also, while "search" looks like the OpenVMS command Search it is not the same. Does the command work interactively, in a telnet/ssh session?OpenVMS search has a /LOG and /KEY but not /SYS, nor /KEYS and /KEY specifies a position and size only. So you may need an environment set up (sylogin.com, login.com) which is not immediately available in 'plink' contents. Mor elikely though you simply need to quote the whole commands and/or escape the inner quote. Try without inner quotes just searching for TRN is that makes snense at all. – Hein Sep 02 '14 at 18:36
  • unrecognized command verb - check validity and spelling is the error message. How to mark escape characters? – Hari Upadrasta Sep 02 '14 at 18:42
  • "google: plink putty quotes" ?http://stackoverflow.com/questions/6738038/plink-cmd-exe-mkdir-with-a-space-doesnt-work – Hein Sep 02 '14 at 19:08
  • What is flagged as "unrecognized command verb", the wnb or the 6789? As far as I know, to escape the inner quotes for DOS/Windows commands double them: "wnb search/keys=""TRN|0567 6789""/log/sys" – user2116290 Sep 02 '14 at 19:10
  • Error on wnb . both with and with out quotes, the same works when i log in and command with putty – Hari Upadrasta Sep 02 '14 at 19:14
  • As Hein mentioned, that indicates that the command "wnb" is defined in a command procedure which is not invoked in the plink environment. I would check the mentioned sylogin.com and login.com where wnb is set as a DCL symbol or command and whether that part of the command procedure is executed in the plink environment (just throw a 'write sys$output "hello"' type of debug statement near the definition of wnb - which in turn may be hidden in another command procedure ...). – user2116290 Sep 02 '14 at 19:26

1 Answers1

0

Trials and errors yield their fruits. Indeed as Hein was suggesting, the issue was with quotes not being properly transmitted, yet with different syntax.

Here's the syntax that worked for me (Windows:plink(0.63) >> VMS):

plink -ssh -l USER HOST -pw PWD "mycommand arg, """quoted arg1""", """quoted arg2""" /opt1 /opt2"

on VMS results in:

mycommand arg, "quoted arg1", "quoted arg2" /opt1 /opt2

THUS: plink>>VMS double-quote=""", but may still have trouble with < > | << >> chars as these are confused for pipes by Windows cmd CLI.

BETTER: use plink -m cmds-file option to pass remote commands in a local file:

plink -ssh -l USER HOST -pw PWD -m cmds.vms

where cmd.vms file contains:

mycommand arg, "quoted arg1", "piped|arg" /opt1 /opt2
vmsnomad
  • 319
  • 2
  • 7