本篇內(nèi)容介紹了“Linux操作系統(tǒng)怎么解決-bash: !: event not found的問題”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!
創(chuàng)新互聯(lián)專注于鷹潭網(wǎng)站建設(shè)服務及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供鷹潭營銷型網(wǎng)站建設(shè),鷹潭網(wǎng)站制作、鷹潭網(wǎng)頁設(shè)計、鷹潭網(wǎng)站官網(wǎng)定制、成都微信小程序服務,打造鷹潭網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供鷹潭網(wǎng)站排名全網(wǎng)營銷落地服務。
短字符串轉(zhuǎn)碼/解碼測試
正常轉(zhuǎn)碼(經(jīng)測試,加單引號、雙引號或者不加引號的結(jié)果):
[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
長字符串轉(zhuǎn)碼/解碼測試(建議使用雙引號,文中會出現(xiàn)單引號等字符,解析成字符串)
正常轉(zhuǎn)碼:
[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.
長字符串轉(zhuǎn)碼指定—wrap參數(shù)測試**
轉(zhuǎn)碼時指定—wrap=0參數(shù),轉(zhuǎn)碼后不換行
[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.
這里說明對長字符串轉(zhuǎn)碼,通過換行參數(shù),明確第N個字符后換行(或者不換行),可以得出不同的轉(zhuǎn)碼結(jié)果。但是對不同轉(zhuǎn)碼值進行解碼后的結(jié)果是一致的,都是原字符串。
特殊字符轉(zhuǎ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
這里說明對特殊字符進行轉(zhuǎn)碼時,應該使用單引號。
解決-bash: !: event not found的問題
為了解決-bash: !: event not found的問題,可以執(zhí)行set +H命令(set命令 參數(shù):-H Shell 可利用”!”加
<指令編號>
的方式來執(zhí)行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操作系統(tǒng)怎么解決-bash: !: event not found的問題”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!