HP Proliant SmartArray nagios check
olli at lurza.secnetix.de
Wed Mar 21 13:45:58 UTC 2007
Søren Klintrup wrote:
> Edwin Groothuis wrote:
> > [...]
> > To overcome the problem of many of [Tt][Hh][Ee][Ss][Ee] kind of
> > string, you can pipe the output through tr(1) so that it at least
> > is human-readable (instead of the minimal requirement of being a
> > cyborg :-)
> > [~] edwin at k7>echo "TtHhEeSsEe" | tr A-Z a-z
> > tthheessee
> As for using 'i' as an option on sed, it doesn't seem to work on FreeBSD
> 6.2 (havn't tested on others, since theres no reason if it doesn't work
> on 6.2 :),
sed doesn't support the "i" option for regexps (I think
it's an extension of gnu-sed only).
> the tr A-Z a-z worked like a charm though, and it's readable
Very careful here. Character rages like the above are
locale-dependant. They are only guaranteed to work as
expected in the C locale. Try this:
$ export LANG=lt_LT.ISO8859-4
$ echo FOOBAR | tr A-Z a-z
Therefore character ranges should be avoided in scripts.
They break for people with certain locale settings.
The portable solution is to use character classes:
$ echo FOOBAR | tr '[:upper:]' '[:lower:]'
Details can be found in the tr(1) manual page which
explains the problem with A-Z a-z.
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart
FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd
"The scanf() function is a large and complex beast that often does
something almost but not quite entirely unlike what you desired."
-- Chris Torek
More information about the freebsd-proliant