本篇内容介绍了“linux操作系统怎么解决-bash: !: event not found的问题”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所
本篇内容介绍了“linux操作系统怎么解决-bash: !: event not found的问题”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
短字符串转码/解码测试
正常转码(经测试,加单引号、双引号或者不加引号的结果):
[root@db5 ~]# echo 123456 | base64MTIzNDU2Cg==[root@db5 ~]# echo '123456' | base64MTIzNDU2Cg==[root@db5 ~]# echo "123456" | base64MTIzNDU2Cg==正常解码:[root@db5 ~]# echo MTIzNDU2Cg== | base64 -d123456[root@db5 ~]# echo 'MTIzNDU2Cg==' | base64 -d123456[root@db5 ~]# echo "MTIzNDU2Cg==" | base64 -d123456
长字符串转码/解码测试(建议使用双引号,文中会出现单引号等字符,解析成字符串)
正常转码:
[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." | base64TWF5IHlvdSBoYXZlIGVub3VnaCBoYXBwaW5lc3MgdG8gbWFrZSB5b3UGC3DlZXQsZW5vdWdoIHRyaWFscyB0byBtYWtlIHlvdSBzdHJvbmcsZW5vdWdoIHNvcnJvdyB0byBrZWVwIHlvdSBodW1hbixlbm91Z2ggaG9wZSB0byBtYWtlIHlvdSBoYXBweT8gQWx3YXlzIHB1dCB5b3Vyc2VsZiBpbiBvdGhlcnPigJlzaG9lcy5JZiB5b3UgZmVlbCB0aGF0IGl0IGh2cnRzIHlvdSxpdCBwcm9iYWjseSBodXJ0cyB0aGUgb3RoZXIgcGVyc29uLCB0b28uCg==
正常解码:
[root@db5 ~]# echo "TWF5IHlvdSBoYXZlIGVub3VnaCBoYXBwaW5lc3MgdG8gbWFrZSB5b3Ugc3dlZXQsZW5vdWdoIHRy> aWFscyB0byBtYWtlIHlvdSBzdHJvbmcsZW5vdWdoIHNvcnJvdyB0byBrZWVwIHlvdSBodW1hbixl> bm91Z2ggaG9wZSB0byBtYWtlIHlvdSBoYXBweT8gQWx3YXlzIHB1dCB5b3Vyc2VsZiBpbiBvdGhl> cnPigJlzaG9lcy5JZiB5b3UgZmVlbCB0aGF0IGl0IGh2cnRzIHlvdSxpdCBwcm9iYWJseSBodXJ0> cyB0aGUgb3RoZXIgcGVyc29uLCB0b28uCg==" | base64 -dMay 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=0TWF5IHlvdSBoYXZlIGVub3VnaCBoYXBwaW5lc3MgdG8gbWFrZSB5b3Ugc3dlZXQsZW5vdWdoIHRyaWFscyB0byBtYWtlIHlvdSBzdHJvbmcsZW5vdWdoIHNvcnJvdyB0byBrZWVwIHlvdSBodW1hbixlbm91Z2ggaG9wZSB0byBtYWtlIHlvdSBoYXBweT8gQWx3YXlzIHB1dCB5b3Vyc2VsZiBpbiBvdGhlcnPigJlzb2VzLklmIHlvdSBmZWVsIHRoYXQgaXQgaHVydHMgeW91LGl0IHByb2JhYmx5IGh2cnRzIHRoZSBvdGhlciBwZXJzb24sIHRvby4K[root@db5 ~]#
正常解码:
[root@db5 ~]# echo "TWF5IHlvdSBoYXZlIGVub3VnaCBoYXBwaW5lc3MgdG8gbWFrZSB5b3Ugc3dlZXQsZW5vdWdoIHRyaWFscyB0byBtYWtlIHlvdSBzdHJvbmcsZW5vdWdoIHNvcnJvdyB0byBrZWVwIHlvdSBodW1hbixlbm91Z2ggaG9wZSB0byBtYWtlIHlvdSBoYXBweT8gQWx3YXlzIHB1dCB5b3Vyc2VsZiBpbiBvdGhlcnPigJlzb2VzLklmIHlvdSBmZWVsIHRoYXQgaXQgaHVydHMgeW91LGl0IHByb2JhYmx5IGh2cnRzIHRoZSBvdGhlciBwZXJzb24sIHRvby4K" | base64 -dMay 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 ! | base64IQo=[root@db5 ~]# echo '!' | base64IQo=[root@db5 ~]# echo "!" | base64-bash: !: event not found如果是多个特殊字符[root@db5 ~]# echo !@ | base64-bash: !@: event not found[root@db5 ~]# echo '!@' | base64IUAK[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 "!" | base64IQo=[root@db5 ~]# echo !@ | base64IUAK[root@db5 ~]# echo "!@" | base64IUAK
“Linux操作系统怎么解决-bash: !: event not found的问题”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注编程网网站,小编将为大家输出更多高质量的实用文章!
--结束END--
本文标题: Linux操作系统怎么解决-bash: !: event not found的问题
本文链接: https://lsjlt.com/news/245181.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0