看板 Linux 關於我們 聯絡資訊
我有一個備份的指令,要在特定的分割區執行,所以第一步要確定mount。 雖然每次上線的的順序可能變掉,我可以用UUID解決這問題,然後我想到 用grep看mount有沒有備份資料夾的文字來確定mount有沒有成功: test -n `mount|grep --color "on /backup type ext4"` 來看有沒有mount只會得到 -bash: test: 太多引數 這樣,看來test不能這樣玩。 所以我想請問有沒有辦法在script中檢查【特定的分割區mount到特定的位置】? -- 因為「其實呢,這場戰爭結束後,我就要回老家結婚了。」 而死亡的角色,據研究指出,背後的傷勢比前面還嚴重。 民明書房─《死亡FLAG──你不可不知的真實》 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 180.176.35.57 ※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1431853752.A.5E6.html
danny8376: `mount|grep --color "on /backup type ext4"` 05/17 17:22
danny8376: 這段不是結果對test不是字串... 05/17 17:23
danny8376: 他會變成test後面的參數 05/17 17:23
LIAR: 啊....是這樣啊,那我該怎麼辦? 05/17 18:48
mail6543210: 用return code, "$?" 05/17 19:48
kerwinhui: 直接用 if grep ... /proc/mounts; then...; fi 05/17 21:59
yvb: test -n "`mount|grep --color "on /backup type ext4"`" 05/18 00:42