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

Re: File locking within zsh?



"Tim Writer" <tim@xxxxxxxxxxx> wrote:
> Okay. But I don't understand this:
> 
>     tim@ganesh% echo $ZSH_VERSION
>     4.2.5
>     tim@ganesh% echo $$; ( echo $$ )
>     18095
>     18095
>     tim@ganesh%

That's standard shell behaviour:  $$ is supposed to be unique to the parent
shell, not to every subshell instance.  You need tricks to get the actual
pid.  This will work on Linux:

zmodload -i zsh/stat
stat +link /proc/self

getpid() is another thing which could be added to the zsh/system module.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



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