Linux操作系统怎么解决-bash:!:eventnotfound的问题
本篇内容介绍了“Linux操作系统怎么解决-bash: !: event not found的问题”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
创新互联专注于鹰潭网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供鹰潭营销型网站建设,鹰潭网站制作、鹰潭网页设计、鹰潭网站官网定制、成都微信小程序服务,打造鹰潭网络公司原创品牌,更为您提供鹰潭网站排名全网营销落地服务。
短字符串转码/解码测试
正常转码(经测试,加单引号、双引号或者不加引号的结果):
[root@db5 ~]# echo 123456 | base64 MTIzNDU2Cg== [root@db5 ~]# echo '123456' | base64 MTIzNDU2Cg== [root@db5 ~]# echo "123456" | base64 MTIzNDU2Cg== 正常解码: [root@db5 ~]# echo MTIzNDU2Cg== | base64 -d 123456 [root@db5 ~]# echo 'MTIzNDU2Cg==' | base64 -d 123456 [root@db5 ~]# echo "MTIzNDU2Cg==" | base64 -d 123456
长字符串转码/解码测试(建议使用双引号,文中会出现单引号等字符,解析成字符串)
正常转码:
[root@db5 ~]# echo "May you have enough happiness to make you sweet,enough trials to make you strong,enough sorrow to keep you human,enough hope to make you happy? Always put yourself in others’soes.If you feel that it hurts you,it probably hurts the other person, too." | base64 TWF5IHlvdSBoYXZlIGVub3VnaCBoYXBwaW5lc3MgdG8gbWFrZSB5b3Ugc3dlZXQsZW5vdWdoIHRy aWFscyB0byBtYWtlIHlvdSBzdHJvbmcsZW5vdWdoIHNvcnJvdyB0byBrZWVwIHlvdSBodW1hbixl bm91Z2ggaG9wZSB0byBtYWtlIHlvdSBoYXBweT8gQWx3YXlzIHB1dCB5b3Vyc2VsZiBpbiBvdGhl cnPigJlzaG9lcy5JZiB5b3UgZmVlbCB0aGF0IGl0IGh2cnRzIHlvdSxpdCBwcm9iYWJseSBodXJ0 cyB0aGUgb3RoZXIgcGVyc29uLCB0b28uCg==
正常解码:
[root@db5 ~]# echo "TWF5IHlvdSBoYXZlIGVub3VnaCBoYXBwaW5lc3MgdG8gbWFrZSB5b3Ugc3dlZXQsZW5vdWdoIHRy > aWFscyB0byBtYWtlIHlvdSBzdHJvbmcsZW5vdWdoIHNvcnJvdyB0byBrZWVwIHlvdSBodW1hbixl > bm91Z2ggaG9wZSB0byBtYWtlIHlvdSBoYXBweT8gQWx3YXlzIHB1dCB5b3Vyc2VsZiBpbiBvdGhl > cnPigJlzaG9lcy5JZiB5b3UgZmVlbCB0aGF0IGl0IGh2cnRzIHlvdSxpdCBwcm9iYWJseSBodXJ0 > cyB0aGUgb3RoZXIgcGVyc29uLCB0b28uCg==" | base64 -d May you have enough happiness to make you sweet,enough trials to make you strong,enough sorrow to keep you human,enough hope to make you happy? Always put yourself in others’shoes.If you feel that it hurts you,it probably hurts the other person, too.
长字符串转码指定—wrap参数测试**
转码时指定—wrap=0参数,转码后不换行
[root@db5 ~]# echo "May you have enough happiness to make you sweet,enough trials to make you strong,enough sorrow to keep you human,enough hope to make you happy? Always put yourself in others’ses.If you feel that it hurts you,it probably hurts the other person, too." | base64 --wrap=0 TWF5IHlvdSBoYXZlIGVub3VnaCBoYXBwaW5lc3MgdG8gbWFrZSB5b3Ugc3dlZXQsZW5vdWdoIHRyaWFscyB0byBtYWtlIHlvdSBzdHJvbmcsZW5vdWdoIHNvcnJvdyB0byBrZWVwIHlvdSBodW1hbixlbm91Z2ggaG9wZSB0byBtYWtlIHlvdSBoYXBweT8gQWx3YXlzIHB1dCB5b3Vyc2VsZiBpbiBvdGhlcnPigJlzb2VzLklmIHlvdSBmZWVsIHRoYXQgaXQgaHVydHMgeW91LGl0IHByb2JhYmx5IGh2cnRzIHRoZSBvdGhlciBwZXJzb24sIHRvby4K[root@db5 ~]#
正常解码:
[root@db5 ~]# echo "TWF5IHlvdSBoYXZlIGVub3VnaCBoYXBwaW5lc3MgdG8gbWFrZSB5b3Ugc3dlZXQsZW5vdWdoIHRyaWFscyB0byBtYWtlIHlvdSBzdHJvbmcsZW5vdWdoIHNvcnJvdyB0byBrZWVwIHlvdSBodW1hbixlbm91Z2ggaG9wZSB0byBtYWtlIHlvdSBoYXBweT8gQWx3YXlzIHB1dCB5b3Vyc2VsZiBpbiBvdGhlcnPigJlzb2VzLklmIHlvdSBmZWVsIHRoYXQgaXQgaHVydHMgeW91LGl0IHByb2JhYmx5IGh2cnRzIHRoZSBvdGhlciBwZXJzb24sIHRvby4K" | base64 -d May you have enough happiness to make you sweet,enough trials to make you strong,enough sorrow to keep you human,enough hope to make you happy? Always put yourself in others’soes.If you feel that it hurts you,it probably hurts the other person, too.
这里说明对长字符串转码,通过换行参数,明确第N个字符后换行(或者不换行),可以得出不同的转码结果。但是对不同转码值进行解码后的结果是一致的,都是原字符串。
特殊字符转码/解码测试**
如果是一个特殊字符
[root@db5 ~]# echo ! | base64 IQo= [root@db5 ~]# echo '!' | base64 IQo= [root@db5 ~]# echo "!" | base64 -bash: !: event not found 如果是多个特殊字符 [root@db5 ~]# echo !@ | base64 -bash: !@: event not found [root@db5 ~]# echo '!@' | base64 IUAK [root@db5 ~]# echo "!@" | base64 -bash: !@: event not found
这里说明对特殊字符进行转码时,应该使用单引号。
解决-bash: !: event not found的问题
为了解决-bash: !: event not found的问题,可以执行set +H命令(set命令 参数:-H Shell 可利用”!”加
<指令编号>
的方式来执行history中记录的指令。)
[root@db5 ~]# echo "!" | base64 -bash: !: event not found [root@db5 ~]# echo !@ | base64 -bash: !@: event not found [root@db5 ~]# echo "!@" | base64 -bash: !@: event not found [root@db5 ~]# set +H [root@db5 ~]# echo "!" | base64 IQo= [root@db5 ~]# echo !@ | base64 IUAK [root@db5 ~]# echo "!@" | base64 IUAK
“Linux操作系统怎么解决-bash: !: event not found的问题”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!
网页标题:Linux操作系统怎么解决-bash:!:eventnotfound的问题
URL分享:http://ybzwz.com/article/goijjh.html