After I scp a file using spawn, the spawn_id, exp8, closes out. gets eof. so, any other commands I run after that, I get this message: an not find channel named "exp8". So I'm assuming that once a spawn occurs, the script defaults to the latest spawn, regardless of whether it still exists or not.
Is there a way to default back to exp7? Or do I have to point out using exp7 on EVERY send and expect command?
The reason I'm asking this is because I can't seem to get scp to work by using a send command. It seems that only a spawn command of scp seems to work. The send version of it seems to just hang there and doesn't actually send the command. I have no problem using send to issue ssh commands into other servers, but it just won't work with scp. So I must use spawn. But I get this problem of trying to progress the program. The program's purpose is to log into a server, copy files from the originating server to the logged in server, then from the logged in server, log into other remote servers only accessible through this "access server" and issue install commands.
I asked this on Linux Questions, but all I get is how I need to be more detailed. So it makes me think nobody there knows the answer but they are quick to find fault with posts. I'm not asking anyone to review any code, plus I cannot post it as it's on another network that's isolated. But if anyone knows the answer to the question that would be great.