检查传输端点未连接

时间:2016-04-06 19:23:03

标签: bash mount

我想监视目录的传输是否与bash连接。

我目前有shell:

#!/bin/bash

mounts=('/mount1' '/mount2' '/mount3' '/mount4' '/HDD');

for mount in "${mounts[@]}"
do
    if grep -qs ${mount} /proc/mounts
    then 
        echo "${mount} is mounted."
    else
        #force remount
        sudo umount -l ${mount}
        sudo fusermount -uz ${mount}
        sudo mount ${mount}

    fi
done

但是grep -qs ${mount} /proc/mounts实际上没有检查端点?我该怎么做呢?

0 个答案:

没有答案