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

Re: locking a file in zsh?



Peter Stephenson wrote:
> # in .zshrc
> zmodload -aF zsh/system b:zsystem
> 
> # in window A
> touch /tmp/zsystem_filelock
> (
>    zsystem /tmp/zsystem_filelock
>    print locked
>    sleep 10
> )
> 
> # in window B
> zsystem /tmp/zsystem_filelock

er... sorry


# in .zshrc
zmodload -aF zsh/system b:zsystem

# in window A
touch /tmp/zsystem_filelock
(
   zsystem flock /tmp/zsystem_filelock
   print locked
   sleep 10
)

# in window B
zsystem flock /tmp/zsystem_filelock


-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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