[問題] set 設定變數空格消失 [感謝DarkKiller已解決]

看板FreeBSD作者 (xunlu)時間13年前 (2011/06/05 17:13), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
請問 date -v -1H "+%b %_d %H" 出現的結果是 Jun 5 16 ^^這裡有空格 但是若我將結果變成變數 set packtime=`date -v -1H "+%b %_d %H"` echo $packtime Jun 5 16 ^空格少一個 請問有辦法解決嗎? 我是要用在grep查詢 少一個空格就查不到了 cat /var/log/filter.log | grep 'date "+%b %_d %H"' 資料內容是這樣的 Jun 5 12:59:58 pfsense pf: 122.96.58.54.39124 > 114.43.203.127.21819: UDP, length 23 Jun 5 12:59:58 pfsense pf: 00:00:00.028174 rule 1/0(match): block in on pppoe0: (tos 0x0, ttl 121, id 224, offset 0, flags [ Jun 5 12:59:58 pfsense pf: 118.166.195.219.55362 > 114.43.203.127.21819: Flags [S], cksum 0xfb1c (correct), seq 86550498 Jun 5 12:59:59 pfsense pf: 00:00:00.592545 rule 1/0(match): block in on pppoe0: (tos 0x0, ttl 116, id 25902, offset 0, flags Jun 5 12:59:59 pfsense pf: 124.11.64.120.64283 > 114.43.203.127.21819: Flags [S], cksum 0x0d0c (correct), seq 2623128094 Jun 5 13:00:00 pfsense pf: 00:00:01.364355 rule 1/0(match): block in on pppoe0: (tos 0x0, ttl 110, id 31094, offset 0, flags Jun 5 13:00:00 pfsense pf: 122.96.58.54.39124 > 114.43.203.127.21819: UDP, length 23 Jun 5 13:00:02 pfsense pf: 00:00:01.560724 rule 1/0(match): block in on pppoe0: (tos 0x0, ttl 116, id 26057, offset 0, flags Jun 5 13:00:02 pfsense pf: 124.11.64.120.64283 > 114.43.203.127.21819: Flags [S], cksum 0x0d0c (correct), seq 2623128094 我要把上一個個小時的LOG檔封存起來 麻煩指導 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.116.128.138
文章代碼(AID): #1DwqYzJC (FreeBSD)
文章代碼(AID): #1DwqYzJC (FreeBSD)