ParallelSSH / parallel-ssh

Asynchronous parallel SSH client library.
https://parallel-ssh.org
GNU Lesser General Public License v2.1
1.2k stars 148 forks source link

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

Closed mghtjohnson631 closed 3 years ago

mghtjohnson631 commented 3 years ago

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 --> <\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

pkittenis commented 3 years ago

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)