Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Thu, 1 Apr 2004 15:37:27 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Volker Quetschke cc: cygwin AT cygwin DOT com Subject: Re: Is !C: a valid environment variable? In-Reply-To: <406C6B13.3070401@scytek.de> Message-ID: References: <406C6B13 DOT 3070401 AT scytek DOT de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.39 On Thu, 1 Apr 2004, Volker Quetschke wrote: > Hi! > > If you start bash from a command prompt, e.g. by starting the > cygwin.bat you get funny environment variables: > > bash-2.05b$ set | grep \! > !C:='C:\cygwin\bin' > > When you exit bash and start it again from the same shell you can > even get: > > bash-2.05b$ set | grep \! > !C:='C:\cygwin\bin' > !EXITCODE=00000000 > > But try to echo any of these, or define one with !. > > bash-2.05b$ export !HELLO=hello > bash: !HELLO=hello: event not found '!' is a bash special character. For a more meaningful error message, try "export \!HELLO=hello". However, I don't believe bash allows variable names containing '!'... > I think this special treatment is a bug, what is the prefered solution? POSIX, however, does allow these names, i.e., the first argument to putenv() can be an arbitrary string (containing everyting but '\0' and '=', IIRC). > The special treatment is done in environ.cc: > > /* Current directory information is recorded as variables of the > form "=X:=X:\foo\bar; these must be changed into something legal > (we could just ignore them but maybe an application will > eventually want to use them). */ > > I'm asking because I have a programm that chokes on ! > environment variables, and he workaround I'm using is always starting > the shell via: C:\cygwin\bin\rxvt.exe -e /usr/bin/bash --login -i > from the desktop or logoing into that machine via ssh. > > Volker Another way of doing this is "env -i /bin/bash --login -i", or, if you just want to unset the troublesome ones, "env `set | sed -ne '/\!/{s/=.*$//; s/^/-u / p}'` bash --login -i". HTH, Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "I have since come to realize that being between your mentor and his route to the bathroom is a major career booster." -- Patrick Naughton -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/