Skip to Content.
Sympa Menu

baslinux - [BL] USB devices

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: Christof Lange <cce.zizkov AT volny.cz>
  • To: baslinux AT lists.ibiblio.org
  • Subject: [BL] USB devices
  • Date: Tue, 2 Jan 2007 18:02:25

Hi list,

I have been trying to make the mounting of USB storage devices
more user-friendly and seem to need some help with scripting.

When I want to mount a floppy the device name is always
the same, i.e. /dev/fd0 . So it is easy to write a script
or an alias in order to mount and unmount the device. e.g.

alias a:='mkdir /A ; mount /dev/fd0 /A'
alias :a='umount /A ; rmdir /A'

With USB storages devices it is a bit more complicated. When I
exchange them they show up at different addresses. When I tested
Sindi's and David's 2.4.31 kernels I realized that the first
deviced plugged in turns up at /dev/sda1 , the second one at
/dev/sdb1 , the third one at /dev/sdc1 and the fourth at /dev/sdd1 .
After that the next device can be mounted from /dev/sda1 again.

I would like to write a script that uses one or more mount points,
but will be able to mount a new device with only one command, eg.
u: (and :u for unmounting). The script, however, must be able to
check where a device is. When I open the 'file' /dev/sda1 in
Midnight commander I get an error message if the device does not
exist and some contents if it exists. How can I check the contents
of these device files automatically? I tried:

cat /dev/sda1 |head -n1|cut -b10 >/dev/null && echo sda1 exists

but this produced a lot of unwanted screen output (error messages
obviously do not come from 'cat') and did not produce the
wanted errorlevel for && in the script.

Which Linux command could I use instead of cat?

Christof




is there

________________________________________________________________

Ceskobratrska cirkev evangelicka - Betlemska kaple na Zizkove
Prokopova 4/216, 130 00 Praha 3, Czech Republic
Tel. (+420) 222 78 06 73 / 222 78 20 02 / 603 18 87 53
http://www.volny.cz/cce.zizkov





Archive powered by MHonArc 2.6.24.

Top of Page