2

I have declared a value for a variable command as

command =4
stdin, stdout, stderr = ssh.exec_command("pwd; ./test.sh command")

when i try to run the above command it show the output as

I am command

but it should return as

I am 4

Any syntax missing in the above command?

Thanks in advance

1 Answer 1

1

You are passing "command" as the string, but you need to pass its value as a string:

ssh.exec_command("pwd; ./test.sh " + str(command))
Sign up to request clarification or add additional context in comments.

3 Comments

I used the above command, Now only pwd is executing bypassing theother commands and the output is as Input:- ssh.exec_command("pwd; ./test.sh" + str(command)) Output:- ['/home/ubuntu\n']
What is in stderr after you execute that?
Thank you john!! This solved the problem. There was no space between those two commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.