locale -uU in ~/.profile

Eric Blake eblake@redhat.com
Tue Sep 30 21:14:00 GMT 2014

On 09/30/2014 11:53 AM, Andrew DeFaria wrote:
> I recently debugged this. I share my home directory from a NetApp filer
> such that I can use it from Cygwin or the various Linux machines at my
> client (largely CentOS). Recently I started seeing:
> Adefaria-lt:ssh cm-db-ltest01
> locale: invalid option -- 'u'
> Try `locale --help' or `locale --usage' for more information.
> Cm-db-test01:
> Hunting this down I found that I have a ~/.profile now (didn't have one
> before) and contained therein is the following:
> # Set user-defined locale
> export LANG=$(locale -uU)

Sounds like cygwin's base-files should be updated to guard
cygwin-specific .profile contents to only occur when uname says it is
running on cygwin.  I'm sure the maintainer would love patches...

> Turns out that on CentOS locale doesn't support -uU. Now this .profile
> came from a refreshing of Cygwin. How best to handle this...

You can guard that with something as simple as:

case $(uname) in
  CYGWIN*) export LANG=$(locale -uU) ;;

(hmm, the moment you also share the .profile with a Solaris box, you'd
have to use `` instead of $(), but that's another story)

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140930/4967ac92/attachment.sig>

More information about the Cygwin mailing list