Hey am new to bash scripts and was wondering how would I capture the output of the ssh command into a bash variable? I looked around and cant seem to get it right. I have tried puts $expect_out(buffer) but when echo it says variable does not exist
I know the response should be just one line and if I want to save that into a variable response and then echo it how would I do that?
A generic idea can be something like as below.
spawnthe ssh sessionsendexpectExample:
The word to wait for after executing the command can vary based on your system. It can be
#or$or>or:; So, make sure you are giving the correct one. Or, you can provide a generalized pattern for the prompt as suchWhile using the
expectafter sending the commands, it can be used as