![]() |
Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
hey all,
I need to make a script which checks if the memory card is plugged in my N900, i.e. is mounted. It goes like... if [ code to see if mmc card plugged in ]; then... Yes, I am still at the learning phase and I tried searching lots of forums and other websites but no go, please HELP! the poor.:( |
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
Bump.
I just want to know the command that checks if the mmc is plugged in or not :( |
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
Sorry to see nobody answer you but you do not need a script to see if your SD card is plugged in or not because it is already built in to the OS.
Are you having problems seeing the sd card?. |
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
You use the browser in your device to see it is there or not also you can use your pc browser to see it and write or mount whatever you want.
You need to be more specific to what problem your having. |
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
hi ithink this should help
$ mount | grep mmc1 | wc -l if result>=1 , u r done |
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
Quote:
I want to make script that does "something" when the sd card is plugged in, and another "thing" when it isn't plugged in. For that to work, I need to implement a code in the script that checks if the memory card is in or not, to see what "thing" it shall do. |
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
Quote:
|
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
The list of what's mounted is /etc/mtab, and the mmc is /dev/mmcblk1p1.
So something like Code:
TEST=`grep -o mmcblk1p1 /etc/mtab`; First line sets the variable $TEST with the output of the command that's in backticks. The grep command searches for the mmcblk1p1 in the list of what's currently mounted, the -o switch says output only what matched. Then, in shell, if that gets us a non zero length response, well, we found what we were grepping for, if not we didn't... |
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
Quote:
|
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
Quote:
p.s. You forgot a ] but never mind, got everything sorted now thanks |
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
Quote:
|
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
It occurs to me that you can save yourself the grep and just check for the readability of a specific path that won't exist unless the SD card is mounted.
Code:
if [ -r "/media/mmc1/systemBackups" ]; then |
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
sure,
cat /proc/partitions | grep mmcblk1 | wc -l u r done too, and you know how much partitions u have ;-) on the SD card :-p |
Re: Newbie simple HELP! in Scripting! How to check if mmc card is mounted or not?
or just "df" and see if /dev/mmcblk1p1 is mounted anywhere. It should be /media/mmc1/
|
All times are GMT. The time now is 11:24. |
vBulletin® Version 3.8.8