Mail Archives: cygwin/2004/04/01/15:37:55
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 !<something>
> 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/
- Raw text -