PDA

View Full Version : Using "umount" in shell script?



Gerlads Mod
March 27th, 2008, 09:09 PM
I am having trouble formatting my PSP's Memory Stick within a shell script.

I won't post the whole script just the part that is messing up.
Shell Script:


device=/dev/sdb1

mkfs.vfat "$device"


That outputs:


mkfs.vfat 2.11 (12 Mar 2005)
/media/disk: No such file or directory

/media/disk is were the PSP was mounted but I unmounted it earlier in the script.


And I don't want to do this:


mkfs.vat /dev/sdb1

I do not want that in my case.

Thanks.

WW
March 27th, 2008, 09:33 PM
Don't put spaces around the =, and don't use the $ in front of the name when you assign the value. E.g.


device=/dev/sdb1
echo $device

Gerlads Mod
March 27th, 2008, 09:36 PM
Thanks for the advice.
I edited the first post and fixed it.

Gerlads Mod
March 27th, 2008, 10:06 PM
This is really wierd.

I tried:
mkfs.vfat "$device"
And I tried:
mkfs.vfat $device
And it doesn't work.

But this works with things like:
fdisk "$device"
And
umount "$device"

Does anyone know how this works.

WW
March 27th, 2008, 10:11 PM
This is really wierd.

I tried:
mkfs.vat "$device"
And I tried:
mkfs.vat $device
And it doesn't work.

What do you mean "...it doesn't work."? What happened?

EDIT: Does the command "mkfs.vat" even exist? The mkfs.* commands are in /sbin, and on my system, there is no "mkfs.vat".

Gerlads Mod
March 27th, 2008, 11:02 PM
Does the command "mkfs.vat" even exist? The mkfs.* commands are in /sbin, and on my system, there is no "mkfs.vat".

Sorry typo. I meant mkfs.vfat.
And it just says:


mkfs.vfat 2.11 (12 Mar 2005)
/media/disk: No such file or directory


/media/disk is were it was mounted earlier in the script, until I unmounted it.

bvmou
March 27th, 2008, 11:21 PM
Have you looked at pmount and pumount?

Gerlads Mod
March 27th, 2008, 11:35 PM
No I tried to change the title but it didn't work.

I need help with mkfs.vfat

mssever
March 28th, 2008, 12:14 AM
I need help with mkfs.vfat
Assuming you've fully updated the original post (since you haven't re-posted the relevant code), you have an error in assigning the device. It should be
device=/dev/sdb1The $ means to get the value, which doesn't make sense if you're trying to set a variable.

Gerlads Mod
March 28th, 2008, 12:42 AM
Godamn another typo.

I'll fix that too.