It is currently Tue, 07 Dec 2021 03:31:20 GMT



 
Author Message
 converting from csh to ksh
How do you convert the following from csh to ksh?

        if ("`tty`" != "/dev/console") exit

I tried the following, but it didn't work.

        if [ "`tty`" -eq "/dev/console" ]
        then
                exit
        fi

An error message appears when I login,
        {HOME:-.}/.profile[12]: [/dev/ttyp4:  not found

Thanks.

are...@wellesley.edu



 Tue, 12 Aug 1997 05:38:14 GMT   
 converting from csh to ksh
: How do you convert the following from csh to ksh?

:       if ("`tty`" != "/dev/console") exit

: I tried the following, but it didn't work.

:       if [ "`tty`" -eq "/dev/console" ]
:       then
:               exit
:       fi

: An error message appears when I login,
:       {HOME:-.}/.profile[12]: [/dev/ttyp4:  not found

That error indicates that you omitted the required space on the
inner edge of the [ character, although in the example above you
have shown it correctly.  Also, you should use the "=" operator,
because the -eq operator is for comparing numbers.

: Thanks.

: are...@wellesley.edu
--
Tim Maher, Ph.D.   CONSULTIX            INTERNET: t...@consultix.wa.com
UPCOMING SEATTLE CLASSES:  AWK Programming, 3/6-9; B/K Shell: 3/13-15
Adv. B/K Shell: 3/27-31, LINUX Workshop: 4/24-25; UNIX Sys Adm, 4/26-28
*In Spring: UNIX for Programmers; Adv. C Shell; UNIX Security Workshop*



 Thu, 14 Aug 1997 11:52:07 GMT   
 
   [ 2 post ] 

Similar Threads


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software