/proc/cmdline
Klaus Steden
klaus.steden at thomson.net
Wed Jun 29 00:40:38 UTC 2005
> 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
More information about the Kickstart-list
mailing list