Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!princeton!udel!burdvax!sdcrdcf!ism780c!mikep From: mikep@ism780c.UUCP (Michael A. Petonic) Newsgroups: comp.unix.questions Subject: Re: Environment variables Message-ID: <7173@ism780c.UUCP> Date: Wed, 26-Aug-87 21:59:12 EDT Article-I.D.: ism780c.7173 Posted: Wed Aug 26 21:59:12 1987 Date-Received: Sat, 29-Aug-87 10:13:35 EDT References: <626@unmvax.unm.edu> <2876@phri.UUCP> Reply-To: mikep@ism780c.UUCP (Michael A. Petonic) Organization: Interactive Systems Corp., Santa Monica CA Lines: 21 In article <2876@phri.UUCP> roy@phri.UUCP (Roy Smith) writes: >In <626@unmvax.unm.edu> mike@turing.UNM.EDU.UUCP (Michael I. Bushnell) writes: >> How can I determine if an environment variable is set using csh? >> (I.e., in a script) > > After a bit of experimentation, I came up with the following > [...] A better was is to use printenv and the "status" variable, like this: printenv FOO > /dev/null if ( $status == 1 ) then variable is not set else variable is set fi or something like that. Look at the man page near the bottom for the return values of printenv. MikeP