大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
本篇内容介绍了“Linux操作系统怎么解决-bash: !: event not found的问题”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成! 本篇内容介绍了“Linux操作系统怎么解决-bash: !: event not found的问题”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
创新互联公司自2013年起,是专业互联网技术服务公司,拥有项目做网站、成都做网站网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元兴宁做网站,已为上家服务,为兴宁各地企业和个人服务,联系电话:18982081108
短字符串转码/解码测试
正常转码(经测试,加单引号、双引号或者不加引号的结果):[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参数测试**
[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