Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!rodan!rodan.acs.syr.edu!jdpeek From: jdpeek@rodan.acs.syr.edu (Jerry Peek) Newsgroups: comp.unix.questions Subject: FUBAR: Undefined variable. (csh) Message-ID: <4128@rodan.acs.syr.edu> Date: 6 Aug 90 16:56:44 GMT Sender: jdpeek@rodan.acs.syr.edu Reply-To: jdpeek@rodan.acs.syr.edu (Jerry Peek) Organization: Syracuse University, Syracuse, NY Lines: 21 Thanks for the help on my question about csh quoting weirdness... Here's one about variables. I want to write a test that is true when a variable is not set, OR when it is not set to a certain value. The test I want looks like this: if ( (!$?var) || ($var != value) ) then # do stuff ... endif But if var isn't set, csh says: var: Undefined variable. and the script aborts. I wrote an ugly mess of nested if's that patched around the problem by putting the ($var != value) on a separate line. But there's gotta be a better way. Can I tell csh not to treat an unset variable as an error (in other words, to act like sh)? I didn't see it in TFM. Thanks. --Jerry Peek; Syracuse University Academic Computing Services; Syracuse, NY jdpeek@rodan.acs.syr.edu, JDPEEK@SUNRISE.BITNET +1 315 443-3995