[net.bugs.2bsd] csh and tset

ARPAVAX:UNKNOWN:dove@mit-dspg@mit-mc (09/15/82)

From: dove at mit-dspg at mit-mc
It is disgusting that "eval `test -s vt52`" works and
"eval `tset -s vt100`" fails.  Apparently, the file matching chars in the
vt100 termcap seq (e.g. '[') cause setenv to come back with a 
too many arguments message.  Why can't there be a way to jam the results
of an execution into a variable without further interpretation?

ARPAVAX:UNKNOWN:dove@mit-dspg@mit-mc (09/15/82)

From: dove at mit-dspg at mit-mc
Sorry, I just noticed something about the problem when typing

eval `tset -sI vt100`

It only happens if TERMCAP has been set to something (as by a previous
tset -sI vt100).  Setting TERMCAP back to "/etc/termcap" prevents the
problem.  Why???

Is there a debug mode in csh that shows (better than verbose) what is 
going on?

ARPAVAX:UNKNOWN:dove@mit-dspg@mit-mc (09/15/82)

From: dove at mit-dspg at mit-mc
Note also that the following always works fine
tset -sI vt100 >file
source file

terryl@sri-unix (09/16/82)

     Actually, nothing that you noted about that way eval works with tset
is entirely correct. If you look at the man page for tset, it says there
is a bug in the way the csh does evals, and the correct way to do a tset is:

	set noglob
	eval `tset [blah] [blah] ...`

     The reason the tset works is that the shell variable noglob stays set
after the first eval. Doing a second eval does not do any file name expansion
because noglob is set from the first eval. The actual bug is that file name
expansion is done by eval before command execution (or some other nonsense
like that).  I don't think the TERMCAP environment variable has anything to
do with it.

					Terry Laskodi
				{dec,ucb}vax!teklabs!terryl	(UUCP)
					or
				terryl@tektronix		(CSNET)
					or
				terryl.tektronix@udel-relay	(ARPA)

ARPAVAX:UNKNOWN:dove@mit-dspg@mit-mc (09/17/82)

From: dove at mit-dspg at mit-mc
My mistake.  The in csh, you must say "set noglob" outside of the
eval `tset -s`.  I had thought that the noglob generated by tset would
take care of it.  Apparently however, the sh passes '[' within single
quotes 

echo `echo 'a[b'`

returns

a[b

in csh that gets an "missing [" message unless noglob is set.
On the other hand in csh

echo 'a[b'

with noglob unset works fine, returning

a[b

Does anyone understand why it would parse the 'a[b' differently when
it was being passed in the first case?  Are the ' being stripped of by
the first parsing causing the cmd line 'echo a[b' to be executed?

thomas (09/18/82)

1. set echo shows what the command looks like just before it is executed.
   Of course, if the shell is blowing up, it might not tell you anything.
2. bracket the tset with 'set noglob', 'unset noglob'.  Use the alias ts:
	alias ts 'unsetenv TERMCAP; set noglob; tset \!*; unset noglob'

CSvax:cak (09/19/82)

I also set nonomatch before doing my tset -- seems to be necessary
for some of our terminals.

Chris Kent, Purdue CS