LINUX.ORG.RU

История изменений

Исправление Old_Hamster, (текущая версия) :

Ты ищешь ЭТО:

RETURN CODES
       0      success
       1      incorrect invocation or permissions
       2      system error (out of memory, cannot fork, no more loop devices)
       4      internal mount bug
       8      user interrupt
       16     problems writing or locking /etc/mtab
       32     mount failure
       64     some mount succeeded

Пример:

#!/bin/bash
mymount="/my_mount_point"

if grep -qs "$mymount" /proc/mounts; then
  echo "It's mounted."
else
  echo "It's not mounted."
  mount "$mymount"
  if [ $? -eq 0 ]; then
   echo "Mount success!"
  else
   echo "Something went wrong with the mount..."
  fi
fi

*если я правильно понял, что хочет ТС

Исходная версия Old_Hamster, :

Ты ищешь ЭТО:

RETURN CODES
       0      success
       1      incorrect invocation or permissions
       2      system error (out of memory, cannot fork, no more loop devices)
       4      internal mount bug
       8      user interrupt
       16     problems writing or locking /etc/mtab
       32     mount failure
       64     some mount succeeded

Пример:

#!/bin/bash
mymount="/my_mount_point"

if grep -qs "$mymount" /proc/mounts; then
  echo "It's mounted."
else
  echo "It's not mounted."
  mount "$mymount"
  if [ $? -eq 0 ]; then
   echo "Mount success!"
  else
   echo "Something went wrong with the mount..."
  fi
fi