[comp.unix.questions] ksh named parameter, question

richr@ai.etl.army.mil (Richard Rosenthal) (02/11/89)

    Can someone explain this behavior in ksh on both B4.3 and SysV?

    $ typeset TMOUT
    integer TMOUT
    $ print $TMOUT
    0
    $ typeset TMOUT=
    $ print $TMOUT
    92328
    $ typeset TMOUT=0
    $ print $TMOUT
    0

    On another machine TMOUT magically becomes 4 instead of 92328
    and that is a real problem!  Then I constantly get 60 second
    timeout warnings.

    Thanks.

    -Rich

-- 
Richard Rosenthal                 Internet:  richr@ai.etl.army.mil
Engineer Topographic Labs             UUCP:  ...!ames!ai.etl.army.mil!richr
Ft. Belvoir, VA 22060-5546          BITNET:  richr%ai.etl.army.mil@CUNYVM
+1 202 355 3653                      CSNET:  richr%ai.etl.army.mil@RELAY.CS.NET

lvc@cbnews.ATT.COM (Lawrence V. Cipriani) (02/16/89)

In article <254@ai.etl.army.mil>, richr@ai.etl.army.mil (Richard Rosenthal) writes:
>     Can someone explain this behavior in ksh on both B4.3 and SysV?
>     $ typeset TMOUT
>     integer TMOUT

You are asking ksh to tell you the type and attributes of TMOUT, so it
told you.

>     $ print $TMOUT
>     0

The current value of TMOUT is 0.

>     $ typeset TMOUT=
>     $ print $TMOUT
>     92328

According to the ksh book, this is not a legal form.  My opinion is that
you should get a syntax error message, however ksh sets it to some garbage
value.  The version of ksh I'm working with now sets it to 0.

>     $ typeset TMOUT=0
>     $ print $TMOUT
>     0
> 
>     On another machine TMOUT magically becomes 4 instead of 92328
>     and that is a real problem!  Then I constantly get 60 second
>     timeout warnings.

Like I said, some "garbage" value.  Don't count on this behavior.  Execute:

	$ TMOUT=3600

and you'll only get the warning after an hour (3600 seconds) of inactivity.
If that's too short, set it to something higher.  There is a maximum value
of TMOUT compiled into ksh.  Setting TMOUT higher than that will result in
it being set to the maximum value.
-- 

Larry Cipriani, att!cbnews!lvc or lvc@cbnews.att.com