Date: Wed, 21 Mar 2007 14:24:17 +0100 (CET) From: Oliver Fromme <olli@lurza.secnetix.de> To: freebsd-proliant@FreeBSD.ORG, soren@klintrup.dk Subject: Re: HP Proliant SmartArray nagios check Message-ID: <200703211324.l2LDOHg4075482@lurza.secnetix.de> In-Reply-To: <45D25504.6020500@klintrup.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
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@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 > again. 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 f¿¿baq 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:]' foobar Details can be found in the tr(1) manual page which explains the problem with A-Z a-z. Best regards Oliver -- 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703211324.l2LDOHg4075482>