我有一个简单的 Python 脚本,它接收用户名和密码作为参数,但我的密码包含两个感叹号。当我调用我的脚本时
salafek@dellboy:~/Desktop/$ emailsender.py -u username -p pass!!
我之前输入的命令替换了感叹号:
salafek@dellboy:~/Desktop/$emailsender.py -u username -p "passemailsender.py -u username -p passwget wget http://www.crobot.com.hr/templog"
我可以用反斜杠 (\
) 转义感叹号,但我的密码会更改。
有没有解决办法,如何在不更改密码的情况下转义感叹号?
最佳答案
您应该能够在 shell 中简单地将内容用单引号括起来。
$ emailsender.py -u username -p 'pass!!'
https://stackoverflow.com/questions/3346502/
相关文章:
python - 如何在 Python 中监听 Linux 中的 'usb device inser
linux - 如何让 GNU screen 读取 .bash_profile/.bash_rc 更
c++ - 如何在 Linux 中找到 'temp' 目录?
php - 脚本 "/home/...../public_html/index.php"的 UID
windows - Node.js 开发,windows 还是 linux?
php - 根据外部请求在 Netbeans 中启动 XDebug
linux - 如何在 Linux 命令行上解析 CSV 文件?