From: Yann Droneaud Date: Wed, 19 May 2010 15:16:42 GMT Subject: Re: [PATCH] t9129: fix UTF-8 locale detection Message-ID: <1274282202.4275.68.camel@localhost> In-Reply-To: <1274215797.16337.16.camel@localhost> Le mardi 18 mai 2010 à 22:49 +0200, Yann Droneaud a écrit : > Le mardi 18 mai 2010 à 10:45 -0700, Linus Torvalds a écrit : > > > > On Tue, 18 May 2010, Yann Droneaud wrote: > > > > > > -if locale -a |grep -q en_US.utf8; then > > > +if locale -a |grep -qE '^en_US\.(utf|UTF)-?8$'; then > > > > While -E is POSIX, I suspect that it's not universal. iirc, you still have > > some really crap fileutils tools coming with Solaris, for example. > > > > You're right, Solaris's own grep doesn't known about -E nor -e. > > And it even doesn't know about -q : > > $ grep -q > grep: illegal option -- q > Usage: grep -hblcnsviw pattern file . . . > Integrating Linus's remarks and some autoconf[1][2] hints, here is a proposal for a portable test: if locale -a |grep -i 'en_US\.utf-*8' > /dev/null ; then It should be as portable as possible without too much work. [1] egrep [2] grep Regards. -- Yann Droneaud