bourne sh, problems with var setting in case/esac

Conor P. Cahill cpcahil at virtech.uucp
Fri Nov 16 00:35:19 AEST 1990


In article <1236 at netmuc.UUCP> bothe at net7.uucp writes:
>#==== start script shtest =====
>case $1 in
>esac |
>cat
>echo ++++++++++++++++ $b

The problem is any processing run in a sub-shell will not effect the 
variables in the parent shell.  Because you use a pipe, the shell
must run a sub-shell to handle the case portion of the pipeline.

>if i don't pipe esac and not use cat, all is ok, but i want to pipe !

Work out some other mechanism to get your desired results.

-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 



More information about the Comp.unix.shell mailing list