我有一个简单的 Python 脚本,它接收用户名和密码作为参数,但我的密码包含两个感叹号.当我调用我的脚本时
I have a simple Python script that receives username and password as arguments, but my password contains two exclamation marks. When I call my script like
salafek@dellboy:~/Desktop/$ emailsender.py -u username -p pass!!
我之前输入的命令替换了感叹号:
a command that I entered earlier replaces the exclamation marks:
salafek@dellboy:~/Desktop/$emailsender.py -u username -p "passemailsender.py -u username -p passwget wget http://www.crobot.com.hr/templog"
我可以用反斜杠 () 转义感叹号,但我的密码会更改.
I can escape exclamation marks with backslash (), but my password changes.
有没有解决办法,如何在不更改密码的情况下转义感叹号?
Is there solution for this, how can I escape exclamation marks without changing my password?
你应该能够在 shell 中简单地用单引号包裹东西.
You should be able to simply wrap things in single quotes in the shell.
$ emailsender.py -u username -p 'pass!!'