Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!phri!roy From: roy@phri.UUCP (Roy Smith) Newsgroups: comp.unix.questions Subject: Re: Environment variables Message-ID: <2876@phri.UUCP> Date: Tue, 25-Aug-87 09:33:12 EDT Article-I.D.: phri.2876 Posted: Tue Aug 25 09:33:12 1987 Date-Received: Thu, 27-Aug-87 02:13:28 EDT References: <626@unmvax.unm.edu> Reply-To: roy@phri.UUCP (Roy Smith) Organization: Public Health Research Inst. (NY, NY) Lines: 33 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 ---------------- #!/bin/csh if (`printenv FOO`X == X) then echo FOO is not set else echo FOO is set endif if (`printenv TERM`X == X) then echo TERM is not set else echo TERM is set endif ---------------- which gives me: FOO is not set TERM is set This works, but is a bit grotty. I suspect there has to be a prettier way to do it, but I don't see any. -- Roy Smith, {allegra,cmcl2,philabs}!phri!roy System Administrator, Public Health Research Institute 455 First Avenue, New York, NY 10016