Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!linus!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP Newsgroups: comp.unix.questions Subject: Re: Environment variables Message-ID: <879@mcgill-vision.UUCP> Date: Sun, 6-Sep-87 02:30:10 EDT Article-I.D.: mcgill-v.879 Posted: Sun Sep 6 02:30:10 1987 Date-Received: Sat, 19-Sep-87 05:39:59 EDT References: <626@unmvax.unm.edu> <2876@phri.UUCP> <159@papaya.bbn.com> Distribution: world Organization: McGill University, Montreal Lines: 34 In article <159@papaya.bbn.com>, rsalz@bbn.com (Richard Salz) writes: > The problem is in distinguishing between "set var value" and > "setenv var value" [...]. > Roy's idea of using printenv is probably better, but his method will > probably cause quoting problems if you try to see if TERMCAP is set > after using tset(1); this seems to do it: > % if ( `printenv TERMCAP | wc -l` == 1 ) echo TERMCAP is set > TERMCAP is set > % if ( `printenv CAP | wc -l` == 1 ) echo CAP is set > % Or even just if { printenv TERMCAP >& /dev/null } then .... endif WARNING if you try this: The following does NOT work correctly. if { printenv TERMCAP >& /dev/null } echo TERMCAP is set This will print nothing regardless of whether TERMCAP is set or not, becuase, believe it or not, the echo command gets its output redirected by the redirection in the {}! (Verified by changing /dev/null to /tmp/foo - system is mtXinu 4.3+NFS, though the bug is present in a local derivative of the 4.2 csh as well, and therefore is presumably present in the 4.2 csh.) The version using then and endif does not suffer from the same problem. der Mouse (mouse@mcgill-vision.uucp)