From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Friesen Date: Tue, 21 Oct 2003 05:35:04 +0000 Subject: RFC: cleaner version of test.block Message-Id: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org I propose the following version of test.block. I think the code's easier to read than the one using "cut", and it removes the dependency on stuff outside of bash. Also, running the call to udev backgrounded makes the whole scan take 1 second, rather than 1 second for each entry. Chris #!/bin/sh # # test.block - run udev(8) on each block device in /sys/block SYSFSDIR=3D/sys # change this for a nonstand sysfs mount point BIN=3D./udev # location of your udev binary export ACTION=ADd # 'add' or 'remove' for i in ${SYSFSDIR}/block/*; do # add each drive export DEVPATH=3D${i#${SYSFSDIR}} $BIN block & # add each partition, on each device for j in $i/*; do if [ -f $j/dev ]; then export DEVPATH=3D${j#${SYSFSDIR}} $BIN block & fi done done ------------------------------------------------------- This SF.net email is sponsored by OSDN developer relations Here's your chance to show off your extensive product knowledge We want to know what you know. Tell us and you have a chance to win $100 http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54 _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel