I want to write a small script to automate some commands in python for unix and linux, thru pexpect.
Ex:
ssh -t [email protected] "uname -r && some_cmd_that_exist_or_not && exec /bin/sh"
The problem, is that I don't know from the beginning what type of the OS the machine has, and in some cases the commands are not available.
In this case the connection is closed and a "command not found is returned". I want to continue executing even if a command is not found.
After that I retrive the output using pyexpect. My issue is that I couldn't find an option to keep the connection open if a commad is not found.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…