bourne sh, problems with var setting in case/esac

Ray Davis rdavis at connie.UUCP
Fri Nov 16 06:05:53 AEST 1990


In <1990Nov15.155604.16714 at usenet.ins.cwru.edu> news at 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.

It isn't the control structure that is the problem, it's the
pipe.  Note that in ksh (and maybe SVR? sh), the pipe causes a
subshell, but redirecting the output of the case to a file does
not.  Note also that if you 'cat | case', the case is not in a
subshell.

Ray
---
Ray Davis
Convex Computer GmbH, Frankfurt, West Germany
unido!connie!rdavis, uunet!convex!rdavis, rdavis at convex.com, +49-69-666-8081



More information about the Comp.unix.shell mailing list