shell中感嘆號與引號用法

線上環境須要按期清理緩存,以下:
html

[root@LB scripts]# curl http://10.238.74.31/irm/manualDataSyncPage!synchronizeCrmGroupCustomerInfo.html?UserName=004&Password=ZHzg-123   shell

-bash: !synchronizeCrmGroupCustomerInfo.html?UserName=004: event not found緩存

  「!」在平常命令中能夠做爲調用history歷史記錄來使用執行某行內容,在shell裏爲特殊字符。bash

在執行curl "http://10.238.74.31/irm/manualDataSyncPage!synchronizeCrmGroupCustomerInfo.html?UserName=004&Password=ZHzg-123"的過程當中,發現「!」沒法被正常解析,加上轉義反斜槓「\」也沒用。curl

[root@LB scripts]# curl http://10.238.74.31/irm/manualDataSyncPage\!synchronizeCrmGroupCustomerInfo.html?UserName=004&Password=ZHzg-123ide

-bash: !event not foundui

   後發如今「!」先後加入空格能夠解決這個問題,但還不夠完美,由於輸入的文件字符也是加了空格後的,感受佔用較長地方,現象以下:url

[root@LB scripts]# curl "http://10.238.74.31/irm/manualDataSyncPage ! synchronizeCrmGroupCustomerInfo.htmlme=004&Password=ZHzg-123"spa

   最後嘗試雙引號與反斜槓同時使用,完美解決問題!具體以下:htm

[root@LB scripts]# curl "http://10.238.74.31/irm/manualDataSyncPage"\!"syncronizeCrmGroupCustomerInfo.html?UserName=004&Password=ZHzg-123" 

<html>

<head>

<title>system.title</title>

<script>

var hexA0s = unescape(' %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0 %A0');

hexA0s = hexA0s + hexA0s + hexA0s + hexA0s;

hexA0s = hexA0s + hexA0s + hexA0s + hexA0s;

hexA0s = hexA0s + hexA0s + hexA0s + hexA0s;

document.title = 'system.title' + hexA0s + hexA0s;

hexA0s = null;

</script>

<meta http-equiv="Pragma" Content="No-cach"></meta>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>

相關文章
相關標籤/搜索