[net.unix] setenv problem in C-shell

jerryp@tektools.UUCP (Jerry Peek) (09/03/86)

In article <1427@tektools.UUCP>, net.unix-wizards, I followed up to a
followup article about "tset":
> In article <3454@brl-smoke.ARPA> DU>@brl-smoke.ARPA writes:
> > You're probably going to hear this a lot...
> 
> and this is probably the 200th article that'll be posted, but I hate to see
> errors posted to the net without corrections...
> 
> > You should do:
> > 
> > set noglob; eval `tset ... `
> 
> Not just that!  Don't forget to do "unset noglob" -- otherwise, the shell
> won't expand filename wildcard characters afterwards.  Do this:
> 
> 	set noglob; eval `tset ...`; unset noglob

I shouldn't have used the word "errors" to describe the earlier
posting -- maybe the author has a different version of "tset" that
automatically outputs a "unset noglob".  My apologies if this is true.

Since then, I've noticed that under 4.3BSD and C-shell, "tset" outputs
both the "set noglob" and "unset noglob" commands automatically.  Here's a
demonstration (since I didn't use the "eval `tset`" business, you see the
output of "tset" on the screen; it doesn't change the current settings in
the shell):

Script started on Wed Sep  3 00:00:34 1986
% tset -sQ '?Enter terminal type'
TERM = (Enter terminal type) 4023
set noglob;
setenv TERM 4023 ;
setenv TERMCAP 'X4|tek4023|4023:so=^_H:se=^_@:cm=\034%r%+\040%+\040:nd=\t:bs:am:cl=4\E^L:co#80:li#24:up=1000UP:';
unset noglob;
% !!
tset -sQ '?Enter terminal type'
TERM = (Enter terminal type) xyz
Type xyz unknown
TERM = (unknown) ^C
% ^D
script done on Wed Sep  3 00:02:39 1986

The second "tset" commandline shows another new feature under 4.3:
if you give a terminal type that isn't in your termcap file, the 4.3BSD
"tset" will print "Type xxx unknown" and ask again.  Pre-4.3 versions
wouldn't ask again; they just quit without doing anything.

--Jerry Peek, Tektronix, Inc.
US Mail:    MS 74-900, P.O. Box 500, Beaverton, OR 97077
uucp:       {allegra,decvax,hplabs,ihnp4,ucbvax}!tektronix!tektools!jerryp
CS,ARPAnet: jerryp%tektools@tektronix.csnet
Phone:      +1 503 627-1603

schoch@nike.UUCP (Steve Schoch) (09/03/86)

In article <1427@tektools.UUCP>, jerryp@tektools.UUCP (Jerry Peek) writes:
> > set noglob; eval `tset ... `
> 
> Not just that!  Don't forget to do "unset noglob" -- otherwise, the shell
> won't expand filename wildcard characters afterwards.  Do this:
> 
> 	set noglob; eval `tset ...`; unset noglob

That is not necessary.  The "tset -s" command prints "unset noglob;" as
the last thing it does, and this is evauated correctly by the eval,
so you really don't need the "unset noglob" on the command line.

		Steve Schoch
		schoch@ames

weil@dataio.UUCP (Steve Weil) (09/03/86)

>> Use eval `tset ..` ; unset noglob

No, "tset -s", emits "unset noglob" as its last instruction.
I can't see why you have to do it again.

mrl@oddjob.UUCP (Scott R. Anderson) (09/14/86)

In article <1446@tektools.UUCP> jerryp@tektools.UUCP (Jerry Peek) writes:
>In article <1427@tektools.UUCP>, net.unix-wizards, I followed up to a
>followup article about "tset":
>> In article <3454@brl-smoke.ARPA> DU>@brl-smoke.ARPA writes:
>> > set noglob; eval `tset ... `
>> Not just that!  Don't forget to do "unset noglob" -- otherwise, the shell
>> won't expand filename wildcard characters afterwards.  Do this:
>> 	set noglob; eval `tset ...`; unset noglob
>Since then, I've noticed that under 4.3BSD and C-shell, "tset" outputs
>both the "set noglob" and "unset noglob" commands automatically.

This is also true of the 4.2 systems around here; unfortunately, that
first "set noglob" doesn't do you any good, as any globbing on `tset ...`
occurs before eval gets to it.  The command "echo `tset ...`" shows you
the arguments that eval actually sees, and they probably aren't what you
want, unless globbing has been turned off.

So, it looks like the mininum we can get away with is

>> > set noglob; eval `tset ... `

-- 

*
  *       *                                   Scott Anderson
   *    *   *      *                          uucp: ihnp4!oddjob!kaos!sra
                 *   *    **                  arpa: oddjob!kaos!sra@lbl-csam
    * *       * *     * *    *   *            bitnet: sra%kaos@UChicago
                               *   * *
     *         *       *      *     * * * * * * * * * * * * * * * * * * * * * *