Reputation: 939
Friends,
I have created a python script for storing variables on servers.
When I run the following it runs properly
if server == '11':
cmd1='p -ssh [email protected] -pw "goorba12345"'
os.system(cmd1)
This runs fine and I can open the server. This command opens putty and log me on the server.
But if the pasword have '|' then it is giving me error:
if server == '11':
cmd1='p -ssh [email protected] -pw "||||||goorba12345"'
os.system(cmd1)
'goorba12345' is not recognized as an internal or external command, operable program or batch file.
I am on windows and opening putty sessions from this script. Any help is highly appreciated. Remember this will run command on DOS. I have tried to use bash escape sequence ^, but didn't worked.
Upvotes: 0
Views: 56
Reputation: 1143
The '|' is getting interpreted by the operating system, so it's trying to pipe the output of the p command to the goorba12345 command. You need to escape the '|' with '^' character:
cmd1='p -ssh [email protected] -pw "^|^|^|^|^|^|goorba12345"'
Upvotes: 2
Reputation: 553
if server == '11':
cmd1='p -ssh [email protected] -pw "^|^|^|^|^|^|goorba12345"'
os.system(cmd1)
Upvotes: 1