{} grouping in sh and ksh
Mike McNally
m5 at lynx.UUCP
Thu Oct 6 09:21:57 AEST 1988
In article <12306 at steinmetz.ge.com> davidsen at crdos1.UUCP (bill davidsen) writes:
> In sh, actions grouped by {} delimiters will be treated as a unit and
>may be used with &&, ||, and redirection. If redirection is used the
>commands will be executed in a subshell. After the commands have been
>run, if a subshell is not used the working directory is reset, such that
>it always works as if a subshell were used.
> Ex: { cd ..; ps -l; pwd; ps -l; } && pwd
Gee, when I try the first example on my BSD machine, sure enough the
working directory is changed for the whole shell. In other words, the
shell doesn't do any fancy switching back to the old wd. Maybe
System V is different.
--
Mike McNally Lynx Real-Time Systems
uucp: {voder,athsys}!lynx!m5 phone: 408 370 2233
Where equal mind and contest equal, go.
More information about the Comp.unix.wizards
mailing list