Environment variable brain damage

David Chase rbbb at RICE.ARPA
Sun Feb 24 09:47:32 AEST 1985


Setting: Vax, Pyramid, Sun, or pdp-11 running csh and sh

Program: csh/sh interaction

Bug:  Environment variables set in the C-shell may cause Bourne shell
to freak out.

Repeat-by: 
1) Set an environment variable containing a hyphen (say "setenv A-B 1")
2) Type "sh"
   The result will be the message "A-B=1: is not an identifier", not a
   shell.
3) Unset that environment variable
4) Now type "sh"

Or just run this file through the C shell.

	echo 'echo I am a shell file' > afile
	chmod +x afile
	setenv A-B 1
	./afile
	unsetenv A-B
	./afile

It will print:
	A-B=1: is not an identifier
	I am a shell file

Fix: I dunno; as a "suggested workaround", don't set any environment
variables like that in the csh.

Enjoy, 

David Chase @ Rice University



More information about the Comp.unix.wizards mailing list