ParallelSSH/parallel-ssh

remove "\n" at the cmd's - enable "tab", "?" char

mghtjohnson631 opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
Perhaps there is a way to do send a "tab" but I have not succeeded.
it's working fine at python-ssh2 and paramiko where the user has the control of the complete cmd string.
e.g.:
cmd = "show interface\n"
cmd = "show interface\t"
cmd = "show interface?"

I can only send the cmd = "show interface\n" in parallel-ssh

Describe the solution you'd like
give the user control of the complete cmd string. Do not add \n by default.

At the moment I think the lib is always adding an \n after the cmd str --> <cmd_str> <\n>
The documentation states:
cmd (str) – The command string to run. Note that \n is appended to every string
run_shell_commands - missing information

Describe alternatives you've considered
The alternative is python-ssh2 or paramiko but I like parallel-ssh much better!

Additional context

Thanks for the interest.

Can use interactive shell to write ad-hoc command strings to the server.

The remote execute feature of SSH requires new lines to be sent at the end of every command string - that is what run_command does.

See documentation on interactive shells, and for the single clients.

client = SSHClient(<..>)

cmd = 'echo me'
with client.open_shell() as shell:
    shell.run(cmd)
print(list(shell.stdout))
print(shell.exit_code)