Date: Tue, 23 Mar 2010 19:47:52 -0700 From: Garrett Cooper <yanefbsd@gmail.com> To: Andrew Thompson <thompsa@freebsd.org> Cc: FreeBSD-Hackers <freebsd-hackers@freebsd.org>, Atom Smasher <atom@smasher.org> Subject: Re: kenv - output needed Message-ID: <7d6fde3d1003231947s74b62337yec0d7f0ff903d69b@mail.gmail.com> In-Reply-To: <20100324014229.GF45454@citylink.fud.org.nz> References: <1003231706140.40436@smasher> <20100323180354.GD45454@citylink.fud.org.nz> <1003240736570.40436@smasher> <7d6fde3d1003231210s38ec9419r5149fa7af6f5bd2b@mail.gmail.com> <1003241407070.40436@smasher> <20100324014229.GF45454@citylink.fud.org.nz>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 23, 2010 at 6:42 PM, Andrew Thompson <thompsa@freebsd.org> wrote: > On Wed, Mar 24, 2010 at 02:09:41PM +1300, Atom Smasher wrote: >> On Tue, 23 Mar 2010, Garrett Cooper wrote: >> >>> Are you looking for data represented similar to sysctl(8)? >> ============ >> >> it doesn't quite have to be, but it is being parsed in a script. > > How about pulling the kenv variables into the script. > > #!/bin/sh > > eval $(kenv | awk -F= '/^smbios/ { gsub("\\\.","_",$1); print $1 "=" $2}') > > echo $smbios_chassis_maker That's assuming that the there are only two tokens separated by = though... Maybe something like the following? eval $(kenv | awk -F= '{ gsub("\\\.", "_", $1); x= ""; for (i=1; i <= NF; i++) { if (i > 1) { x = x "="; } x = x "" $i; } print $1 "=" $x }') Thanks, -Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7d6fde3d1003231947s74b62337yec0d7f0ff903d69b>