Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Feb 2010 21:08:22 +0000
From:      Andrew Brampton <brampton+freebsd@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   sysctl with regex?
Message-ID:  <d41814901002091308s7e894b55p880bde165bbbe703@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Today I was writing a script to read all the dev.cpu.?.temperature
sysctl OIDs. I was parsing them using a simple grep, but it occurred
to me it might be better if sysctl supported some form of regexp. For
example instead of typing:
sysctl -a | grep dev.cpu.*.temperature

I could write:
sysctl dev.cpu.*.temperature

which would display all the OIDs that match dev.cpu.*.temperature.
This is better than grep because when I issue a "sysctl -a" the
program retrieves many variables that I am not interested in (which
later get filtered by grep). This would in a way be similar to: sysctl
dev.cpu

which lists all the OIDs under dev.cpu. Is this a feature people would
find useful? Or would I be optimising a problem that doesn't exist?

Thanks for any input
Andrew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d41814901002091308s7e894b55p880bde165bbbe703>