conditional to tell if a drive is mounted using
Hi there,
How can you tell if a drive is mounted. I have a hard drive called Secure_HDD and I am trying to see if is mounted or not. I found this script to try, but it just comes as Not Mounted when it is clearly mounted and I can write to it; Code:
#!/bin/bash |
My first question would be, once mounted, have you confirmed that the grep works?
Code:
sudo mount | grep media/pi/Secure_HDD/ |
Hi,
Ok, I have solved my issue of not getting a conditional to work by using: Code:
#!/bin/bash Kind regards iFunc |
Are you not able to show the output from the grep command?
Why did you pick -w option, does this file need to be writable by you? Will it always exist? What if it exists but is not writable by you? |
not to speak about that file may exist on the root filesystem too, therefore not really safe....
mount will work without sudo. what about grep -F (or fgrep?) |
Use mountpoint
Code:
if mountpoint -q $yourmountpoint ; then |
n/m.
|
All times are GMT -5. The time now is 02:15 AM. |