&quot“回声密码| sudo -s&quot带有感叹号
我想做的是
$ echo密码!P | sudo -s [命令]
Linux终端中的 (在我的情况下,Ubuntu20.04)。如果按原样键入它,则感叹号将参考命令行的历史记录,如果!p = pwd,它将是诸如passwordpwd之类的字符串,并且不会正确发送密码!p。我已经尝试了各种方法来逃脱感叹号,例如“密码!p”,“密码!p”,“ password!p'\''等。最后一个行为与'echo |相同。 '但没有导致使用该命令。有什么方法可以解决吗?
What I want to do is
$ echo password!p | sudo -S [command]
in a linux terminal (in my case, ubuntu20.04). If you type it as it is, the exclamation mark will refer to the history of the command line, and if !p=pwd, it will be a string like passwordpwd and will not send the password!p correctly. I have tried every way I could find to escape the exclamation, like 'password!p', 'password!p', '\''password!p'\'', etc. The last one behaves the same as 'echo |' but did not result in using the command. Is there any way to get through this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以尝试关闭历史扩展。
Could try turning off history expansion.