“-bash: !”: event not found"、echo > sudo permission denied
来源:互联网 发布:听知有声小说阅读器 编辑:程序博客网 时间:2024/06/03 12:37
1. “-bash: !”: event not found”
比如当我们在 linux 命令行输入echo "Reboot your instance!"
时,便会给出标题的错误信息。之所以如此,在于对于 bash !
是一个有着特殊含义的字符,常常用来指代之前的命令。
$ history | less$ !某一数字$ !! 运行上一命令
Understanding the exclamation mark (!) in bash
因此,这里 echo "reboot your instance!"
中的感叹号,便是将以 !
之后的字符为开始的上一条命令。
常用的解决方案如下:
set +o histexpand
/set +H
,关闭 bash 中的 history expansion(历史拓展)
2. 对 echo 输出重定向(>)时:permission denied
Cannot echo “hello” > x.txt even with sudo?
Redirect the output using sudo
$ sudo echo "hello" > f.txt
即使使用 sudo,仍然提示 permission denied
,这是因为 bash 中的重定向操作在 sudo 生效之前已经开始执行了。
解决方法如下两种:
sudo bash -c 'echo "hello" > f.txt'
echo "hello" | sudo tee f.txt
0 0
- “-bash: !”: event not found"、echo > sudo permission denied
- 避免’sudo echo x >’ 时’Permission denied’ 甲: 示例 sudo echo a > 1.txt -bash: 1.txt: Permission denied 乙:
- 避免’sudo echo x >’ 时’Permission denied’
- 避免’sudo echo x >’ 时’Permission denied’
- 避免’sudo echo x >’ 时’Permission denied’
- sudo echo x >’ 时’Permission denied’
- sudo echo x > **.** 时 base: : Permission denied
- 避免’sudo echo x >’ 时’Permission denied’
- -bash: !": event not found
- -bash: !": event not found
- bash: !": event not found
- ubuntu 避免’sudo echo x >’ 时’Permission denied’
- -bash: !css": event not found
- Not found in archive 和 Permission denied
- 避免’sudo echo x >’(sudo 重定向) 时’Permission denied’
- sudo 找不到 (-bash sudo : command not found)
- Linux学习笔记 --- -bash: !": event not found
- -bash: ./mysql_install_db: Permission denied
- 《C语言及程序设计》实践项目——动态数组 ->【项目1-学生人数没个准】
- 原串反转
- Activity与Fragment
- Jquery常用工具集
- 积分系统——实现文字到图片的转化
- “-bash: !”: event not found"、echo > sudo permission denied
- 【C++】尽可能使用const
- 山东省第六届ACM竞赛 山东理工SDUT3258 Square Number
- ios iOS中改变部分字体颜色
- linux(kali,centos)安装vm及其提示缺少c头文件解决方法
- SpringBoot非官方教程 | 第二十二篇: 创建含有多module的springboot工程
- 算法导论 练习题 11.1-4
- 2016年全球50个创新趋势
- OSS.Common获取枚举字典列表标准库支持