From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lindsay Haisley Date: Mon, 25 Oct 2004 07:46:22 +0000 Subject: Re: udevstart.c -> kscan.c Message-Id: <20041025074622.GD23239@fmp.com> List-Id: References: <20041025063019.GB23239@fmp.com> In-Reply-To: <20041025063019.GB23239@fmp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Thus spake Lindsay Haisley on Mon, Oct 25, 2004 at 02:22:28AM CDT > > > Also, what you are looking for (a list of all kernel class devices) can > > be done with the following short bit of shell code. Feel free to add > > the 'KERNEL=' portion to the beginning of every line if you think it's > > necessary. For what it's worth, this prettys it up a bit and adds copy 'n paste convenience. ------------------------------------- #! /bin/bash # # Directory where sysfs is mounted SYSFS_DIR=/sys # handle block devices and their partitions echo "Block Devices:" for i in ${SYSFS_DIR}/block/*; do # each drive echo -n " KERNEL=\"" echo -n ${i#${SYSFS_DIR}/block/} echo \" # each partition, on each device for j in $i/*; do if [ -f $j/dev ]; then echo -n ${j#${SYSFS_DIR}} | awk -F/ '{printf(" KERNEL=\"%s\"\n", $4)}' fi done done echo; echo "Other Devices:" # all other device classes for i in ${SYSFS_DIR}/class/*; do for j in $i/*; do if [ -f $j/dev ]; then echo -n ${j#${SYSFS_DIR}} | awk -F/ '{printf(" KERNEL=\"%s\"\n", $4)}' fi done done -- Lindsay Haisley | "Fighting against human | PGP public key FMP Computer Services | creativity is like | available at 512-259-1190 | trying to eradicate | http://www.fmp.com | dandelions" | | (Pamela Jones) | ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ 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