[问题] 如何在script中确定mount有成功

楼主: LIAR (玻璃做的大叔)   2015-05-17 17:09:06
我有一个备份的指令,要在特定的分割区执行,所以第一步要确定mount。
虽然每次上线的的顺序可能变掉,我可以用UUID解决这问题,然后我想到
用grep看mount有没有备份资料夹的文字来确定mount有没有成功:
test -n `mount|grep
作者: danny8376 (钓到一只猴子@_@)   2015-05-17 17:22:00
`mount|grep --color "on /backup type ext4"`这段不是结果对test不是字串...他会变成test后面的参数
楼主: LIAR (玻璃做的大叔)   2015-05-17 18:48:00
啊....是这样啊,那我该怎么办?
作者: mail6543210 (mail6543210)   2015-05-17 19:48:00
用return code, "$?"
作者: kerwinhui (kezza)   2015-05-17 21:59:00
直接用 if grep ... /proc/mounts; then...; fi
作者: yvb   2015-05-18 00:42:00
test -n "`mount|grep --color "on /backup type ext4"`"

Links booklink

Contact Us: admin [ a t ] ucptt.com