Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!ogicse!littlei!gandalf!andyc From: andyc@bucky.intel.com (Andy Crump) Newsgroups: comp.unix.shell Subject: Re: bourne sh, problems with var setting in case/esac Message-ID: Date: 29 Nov 90 16:02:34 GMT References: <1236@netmuc.UUCP> <1990Nov15.155604.16714@usenet.ins.cwru.edu> Sender: news@littlei.UUCP Distribution: comp Organization: Intel Corporation, Hillsboro, Oregon Lines: 27 In-reply-to: rdavis@connie.UUCP's message of 15 Nov 90 19:05:53 GMT >>>>> On 15 Nov 90 19:05:53 GMT, rdavis@connie.UUCP (Ray Davis) said: Ray> In <1990Nov15.155604.16714@usenet.ins.cwru.edu> news@usenet.ins.cwru.edu writes: >>if i don't pipe esac and not use cat, all is ok, but i want to pipe ! >Sh runs control structures with pipes in a subshell. Variables set in a >subshell cannot affect the parent's settings. Ray> It isn't the control structure that is the problem, it's the Ray> pipe. Note that in ksh (and maybe SVR? sh), the pipe causes a Ray> subshell, but redirecting the output of the case to a file does Ray> not. Note also that if you 'cat | case', the case is not in a Ray> subshell. I tried this on Intel SVR4 version 2.0 with both ksh and sh and they behave exactly as everyone describes. The pipe causes a subshell. You have been zapped by Mr. SubShell. -- -- Andy Crump ...!tektronix!reed!littlei!andyc | andyc@littlei.intel.com ...!uunet!littlei!andyc | andyc@littlei.uu.net Disclaimer: Any opinions expressed here are my own and not representive of Intel Corportation.