Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!spool.mu.edu!snorkelwacker.mit.edu!mit-eddie!uw-beaver!zephyr.ens.tek.com!tektronix!sequent!calvin From: calvin@sequent.UUCP (Calvin Goodrich) Newsgroups: comp.unix.shell Subject: Re: One line If-then-else block in csh possible? Keywords: csh programming Message-ID: <53338@sequent.UUCP> Date: 15 Feb 91 21:42:16 GMT References: <1991Feb13.180658.16244@msuinfo.cl.msu.edu> <5828@iron6.UUCP> Reply-To: calvin@sequent.sequent.com (Calvin Goodrich) Distribution: comp Organization: Sequent Computer Systems, Inc. Lines: 35 In article <5828@iron6.UUCP> yeates@motcid.UUCP (Tony J Yeates) writes: >harichan@eecae.uucp (Ronald Harichandran) writes: > >>Is it possible to have an if-then-else-endif block on a single line? > >The only thing I can think of is:- > >if () then ; command ; else ; command ; endif > >which when I try it does NOT work. > >The csh man page says "The words else and endif must be the first nonwhite >characters on a line." Oh, it also describes the if() command bug mentioned above. >Guess we're SOL! for csh users, yes. for ksh users, no. in ksh you're allowed to use the form: if [ expr ]; then ; else ; fi unfortunately, it doesn't work that way for csh. believe me, i've tried lots-o-different combinations of ;'s but it comes back and says "else: endif not found". apparently csh requires that the endif be on it's own line. have a day, eh. calvin. Calvin Goodrich / calvin@sequent.sequent.com a\=k)4vk!%t@$+... (beep!) "Scotty, we need that .sig in thirty seconds or we're all dead!" "Och, Captain! We canna do anathin'! It's still on yir other account!" (Starfleet. It's not just an adventure, it's a job.)