/proc/cmdline

Dan Trainor info at hostinthebox.net
Wed Jun 29 00:44:41 UTC 2005


Klaus Steden wrote:
>>Hello, all -
>>
>>What's the weapon of choice when extracting values from /proc/cmdline?
>>grep, cut, awk, sed?  perl?  I don't know.  I'm just trying to get a
>>better idea of how I can use cmdline.
>>
> 
> Dan,
> 
> I typically use grep to test for the presence of what I'm looking to match,
> and then sed to extract it. Options in /proc/cmdline are usually of the form
> <name> or <name>=<value>. So, for instance ...
> 
> -- cut --
> if grep -i -q "class=[a-zA-Z0-9]" /proc/cmdline
> then
>     CLASS=`cat /proc/cmdline | sed 's/.*class=\([^ ]*\).*/\1/'`
> fi
> -- cut --
> 
> hth,
> Klaus
> 
> 

Klaus -

It does help, thanks.  I just want to make sure that I am using cmdline
to it's full potential.

Thanks
-dant




More information about the Kickstart-list mailing list