From: Mark Wooding Date: Thu, 26 Mar 2009 16:30:29 +0000 (+0000) Subject: bash_profile: Slightly more intelligent locale handling. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/703b345db47db286d852a77fe91a1000151e86b6?ds=inline;hp=--cc bash_profile: Slightly more intelligent locale handling. First of all, set LANG and LC_COLLATE and leave the rest alone. LANG defaults most of the other variables, and forcing LC_COLLATE=POSIX fixes the stupidity of ls(1) ordering things case-insensitively. Secondly, if there's no DISPLAY, and TERM is `linux', prod vt-is-UTF8(1) to find out which locale to use. --- 703b345db47db286d852a77fe91a1000151e86b6 diff --git a/bash_profile b/bash_profile index 57475a8..7488133 100644 --- a/bash_profile +++ b/bash_profile @@ -112,18 +112,23 @@ umask 002 [ -z "$HOST" ] && export HOST=`hostname` -if [ "$DISPLAY" = "" ]; then - : ${LC_CTYPE=${LANG-${LC_ALL-`mdw-conf console-ctype`}}} +if [ "$DISPLAY" != "" ]; then + LANG=`mdw-conf x-ctype` else - LC_CTYPE=`mdw-conf x-ctype` + : ${LANG=${LC_CTYPE-${LC_ALL-`mdw-conf console-ctype`}}} + case "$TERM" in + linux) + if vt-is-UTF8 >/dev/null 2>&1; then + ctype=.utf8 + else + ctype= + fi + LANG=${LANG%.*}$ctype + ;; + esac fi -unset LANG LC_ALL -export LC_CTYPE - -for lc in TIME NUMERIC MONETARY PAPER NAME ADDRESS TELEPHONE MEASUREMENT; do - eval "export LC_$lc=$LC_CTYPE" -done -export LC_COLLATE=POSIX +unset LC_ALL +export LC_COLLATE=POSIX LANG __mdw_programp distcc && export CCACHE_PREFIX=distcc