What’s the best way to check if a volume is mounted in a Bash script? What I’d really like is a method that I can use like this: if <something is mounted at /mnt/foo> then <Do some
/etc/mtabbecause it may be inconsistent.
mountbecause it needn’t be that complicated.
if grep -qs '/mnt/foo' /proc/mounts; then echo "It's mounted." else echo "It's not mounted." fi