Date: Wed, 23 Feb 2011 09:32:37 +0200 From: Mikolaj Golub <to.my.trociny@gmail.com> To: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net> Cc: Josh Paetzel <jpaetzel@FreeBSD.org>, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r218959 - head/usr.sbin/pc-sysinstall/backend-query Message-ID: <854o7vkxyi.fsf@in138.ua3> In-Reply-To: <20110223011759.W13400@maildrop.int.zabbadoz.net> (Bjoern A. Zeeb's message of "Wed, 23 Feb 2011 01:23:50 %2B0000 (UTC)") References: <201102221918.p1MJIukV018893@svn.freebsd.org> <20110223011759.W13400@maildrop.int.zabbadoz.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 23 Feb 2011 01:23:50 +0000 (UTC) Bjoern A. Zeeb wrote: BAZ> On Tue, 22 Feb 2011, Josh Paetzel wrote: >> Author: jpaetzel >> Date: Tue Feb 22 19:18:56 2011 >> New Revision: 218959 >> URL: http://svn.freebsd.org/changeset/base/218959 >> >> Log: >> Better method for grabbing disk name, dmesg may produce mangled output. >> >> Approved by: kib (mentor, implicit) >> >> Modified: >> head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh >> >> Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh >> ============================================================================== >> --- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Tue Feb 22 19:05:42 2011 (r218958) >> +++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Tue Feb 22 19:18:56 2011 (r218959) >> @@ -74,7 +74,7 @@ do >> fi >> >> # Check the dmesg output for some more info about this device >> - NEWLINE=$(dmesg | sed -n "s/^$DEV: .*<\(.*\)>.*$/ <\1>/p" | head -n 1) >> + NEWLINE=$(camcontrol identify $DEV | grep "device model" | tr -s ' ' | sed 's |device model ||g') BAZ> Sure sed works if there is a blank between s and the delimiter? BAZ> May I suggest nothing shorter but two pipes less, though not exactly BAZ> the same with regard to whitespace stripping in and after the device BAZ> name but that could be fixed easily as well. BAZ> camcontrol identify $DEV | awk '/device model/ { gsub("device model[[:space:]]*", ""); print; }' BAZ> I am sure it can still be done way more clever but ... what about this? :-) camcontrol identify $DEV | sed -ne 's/^device model *//p' -- Mikolaj Golub
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?854o7vkxyi.fsf>