如何在 Linux 上传递带感叹号的参数? [英] How to pass argument with exclamation mark on Linux?

查看:19
本文介绍了如何在 Linux 上传递带感叹号的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的 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!!'

这篇关于如何在 Linux 上传递带感叹号的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆