On Feb 27, 2013, at 10:54 AM, David Korn wrote:
> You can also run a subshell for which side effects do not disappear.
>
> Instead of $(...), use ${ ...;}. Note, that the space is required.
> It will run the command substitution in the current shell so that side
> effects will remain.
>
> ${ ...;} is documented in the man page.
thanks, works nicely for the most part, but i'm seeing something weird:
if i change PATH inside the ${ ...;}, the effect persists, but ksh doesn't seem
to notice
("which", the GNU executable, does)
man ksh and alias --man don't document a "hash -r", but doing it anyway seems
to be the solution. is this expected?
$ echo ${.sh.version}
Version AJM 93u+ 2012-08-01
$ export PATH=/bin:/usr/bin:
$ type -a foo
./ksh: whence: foo: not found
$ which foo
which: no foo in (/bin:/usr/bin:)
$ ls ~/bin/foo
/home/adavies/bin/foo
$ out=${ PATH=$PATH:~/bin;}
$ type -a foo
./ksh: whence: foo: not found
$ which foo
/home/adavies/bin/foo
$ echo $PATH
/bin:/usr/bin::/home/adavies/bin
$ hash -r
$ type -a foo
foo is a tracked alias for /home/adavies/bin/foo
$
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users