This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with Bash regex test case sensitivity


On Sat, Dec 04, 2010 at 10:05:42AM -0400, Lee wrote:
> > On 12/03/2010 07:11 PM, Lee wrote:
> 
> why put the local
> defaults in ~/.bashrc?  My understanding is that ~/.bashrc is called
> at every shell startup.  Seems like that's one of those things that
> just needs to be set in the login shell, so wouldn't ~/.bash_profile
> be more appropriate for the locale settings?

(Most probably you already know all of this, but...)
As of now, the default settings are provided via /etc/profile:

if [ -d "/etc/profile.d" ]; then
  while read f; do
    if [ -f "${f}" ]; then
      . "${f}"
    fi
  done <<- EOF
  `/bin/find -L /etc/profile.d -type f -iname '*.sh' -or -iname '*.zsh' | LC_ALL=C sort`
  EOF
fi

which in turn sources /etc/profile.d/lang.sh:

# if no locale variable is set, indicate terminal charset via LANG
test -z "${LC_ALL:-${LC_CTYPE:-$LANG}}" && export LANG=C.UTF-8

The bash manual page explains the order in which startup files are
read for both login and non-login shells (both interactive and
non-interactive). So, given that ~/.bash_profile sources ~/.bashrc, (in
our cygwin defaults), that looks like an easy way to set your LANG in a 
per-user manner, no matter what kind of shell you open.
If you want it to be a system-wide setting, you should use
/etc/bash.bashrc (for the bash shell, of course).
Setting it only in ~/.bash_profile makes it invisible for non-login
shells.

-- 
Huella de clave primaria: 0FDA C36F F110 54F4 D42B  D0EB 617D 396C 448B 31EB

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]