Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: File locking within zsh?




----- Original Message ----- From: "Tim Writer" <tim@xxxxxxxxxxx>
To: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
Cc: <zsh-users@xxxxxxxxxx>
Sent: Thursday, May 11, 2006 10:25 AM
Subject: Re: File locking within zsh?


Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> writes:

On May 10,  6:04pm, Tim Writer wrote:
}
} IIRC, zsh avoids forking in subshells but don't most
} shells implement subshells with fork()?

Zsh forks for subshells, too.  It may avoid an *additional* fork when
the only thing the subshell does is execute an external command, but
it always forks at least once.

Okay. But I don't understand this:

   tim@ganesh% echo $ZSH_VERSION
   4.2.5
   tim@ganesh% echo $$; ( echo $$ )
   18095
   18095
   tim@ganesh%

Without special measures, wouldn't both $$ be expanded at the same time before the line is executed, before the subshell is forked?

However, I avoid all possible globbing issues and still get your result:
set |(cat;set) |less

'$'=6511
PPID=6474
'$'=6511
PPID=6474

Brian K. White  --  brian@xxxxxxxxx  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro  BBx    Linux  SCO  FreeBSD    #callahans  Satriani  Filk!



Messages sorted by: Reverse Date, Date, Thread, Author