SSH commands on separate lines: same SSH session?

I know we’ve had discussions about this before, but I can’t find any documentation on this, and I just want to make sure I’m remembering correctly. If I did something like:

#! REMOTE::SSH
foo=“bar”
echo $foo

There is no guarantee that the second command will print ‘bar’. Correct? I.e., in the SSH section, if commands are on separate lines, they might or might not run within the same SSH session.

(I know I can do this in one line – this is just a simple example to hopefully make the question easy to understand).

I will document the answer in the wiki.

@Yoni_Leitersdorf sorry to bug you about this, but I’m guessing you know the answer to my question?

Hi @Hawkeye_Parker

I think you refer to the next

We faced this issue with the fortigate firewalls The received answer was more or less as you described it.
“There is no guarantee that the second command will print ‘bar’. Correct? I.e., in the SSH section, if commands are on separate lines, they might or might not run within the same SSH session.”

1 Like

Yep @Vasileios_Bouloukos got it right @Hawkeye_Parker

1 Like

@Vasileios_Bouloukos @Yoni_Leitersdorf Thanks guys: documented here:
https://indeni.atlassian.net/wiki/spaces/IKP/pages/560103453/Remote+SSH+Shell+Command+Guide