X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Thu, 3 Dec 2009 16:29:31 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: Base-Files (was Re: Unset TMP/TEMP in profile?) Message-ID: <20091203212931.GA23524@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20091201091515 DOT GC30043 AT calimero DOT vinschen DOT de> <89d87180772edf0cb5974b7d21ed1f50 DOT squirrel AT mail DOT morrison DOT mine DOT nu> <20091202093042 DOT GO8059 AT calimero DOT vinschen DOT de> <4B16A22A DOT 4070402 AT towo DOT net> <20091202182140 DOT GT8059 AT calimero DOT vinschen DOT de> <20091202183652 DOT GA13591 AT ednor DOT casa DOT cgf DOT cx> <4B181F65 DOT 5010605 AT towo DOT net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B181F65.5010605@towo.net> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Thu, Dec 03, 2009 at 09:28:21PM +0100, Thomas Wolff wrote: >Christopher Faylor wrote: >> On Wed, Dec 02, 2009 at 07:21:40PM +0100, Corinna Vinschen wrote: >> >>> On Dec 2 18:21, Thomas Wolff wrote: >>> >>>> Corinna Vinschen wrote in another thread about setting LANG: >>>> >>>>>> ... Andy and Thomas, please work >>>>>> out the best solution together. It should work in sh and csh. Then >>>>>> post it as reply to http://cygwin.com/ml/cygwin/2009-12/msg00090.html so >>>>>> John can put it into the base-files package. >>>>>> >>>> Our worked-out proposal is as follows: >>>> >>>> >>>> /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 >>>> >>>> /etc/profile.d/lang.csh: >>>> >>>> # if no locale variable is set, indicate terminal charset via LANG >>>> ( test $?LC_ALL = 0 || test -z "$LC_ALL" ) && ( test $?LC_CTYPE = 0 || test -z "$LC_CTYPE" ) && ( test $?LANG = 0 || test -z "$LANG" ) && setenv LANG C.UTF-8 >>>> >>> Thanks to both of you. >>> >> >> I wasn't paying attention before, so I apologize for not commenting >> sooner but couldn't all of the above be one test statement or at least >> handled inside '{}' rather than '()'. Maybe bash optimizes that away >> but, if it doesn't, then forking subshells will be rather expensive on >> Cygwin. >> >For bash and other sh-alike shells, test is a built-in, but not for tcsh >- sorry I did not consider this. >So an if statement should be used. I don't see, however, how {} would >help - if you mean to embed an invocation of test >in an if expression, that doesn't help because test would still be forked. >The expression if ( $?LC_ALL == 0 || "$LC_ALL" == "" ) on the other '()' starts a subshell. '{}' doesn't. You probably don't need either '()' or '{}' though since "test" also understands parenthesized instructions. So it just has to be run once. I think Corinna has already demonstrated another construct for tcsh which will give similar results. cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple