zsh-users
 help / color / mirror / code / Atom feed
* File locking within zsh?
@ 2006-05-09 22:04 Lloyd Zusman
  2006-05-10  3:31 ` Tim Writer
  2006-05-10  6:29 ` DervishD
  0 siblings, 2 replies; 27+ messages in thread
From: Lloyd Zusman @ 2006-05-09 22:04 UTC (permalink / raw)
  To: zsh-users

Do any of you know of any functions, primitives, tricks, hacks, or even
outright abominations which will allow me to do cooperative file locking
from within zsh?

I know that I can do this with a number of compiled executables, but I'm
looking for a zsh-only solution.

Assuming some sort of zsh locking operator called "lock", consider
this example (within a zsh script):

  lock -x -t 0 file  # for this example of a hypothetical operator, '-x'
                     # means to wait until I get an exclusive lock, and
                     # '-t 0' means no time out
  print foo bar baz >>file
  # do a whole lot of other stuff to "file"
  unlock file # release the lock

In this example, any other zsh script which asks for an exclusive lock
on "file" using this hypothetical "lock" operator will block until the
"unlock" operator has been invoked.

Can this be done somehow in zsh, or do I have to rely on a compiled
executable to accomplish this?

Thanks in advance.

-- 
 Lloyd Zusman
 ljz@asfast.com
 God bless you.


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2006-05-17 16:08 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-09 22:04 File locking within zsh? Lloyd Zusman
2006-05-10  3:31 ` Tim Writer
2006-05-10  5:59   ` Brian K. White
2006-05-10 10:02     ` Lloyd Zusman
2006-05-10 22:04       ` Tim Writer
2006-05-11  3:41         ` Bart Schaefer
2006-05-11 14:25           ` Tim Writer
2006-05-11 15:01             ` Peter Stephenson
2006-05-12  4:22               ` Tim Writer
2006-05-12  9:17               ` Subshells and parameters (was: File locking within zsh?) Vincent Lefevre
2006-05-12 12:09                 ` Subshells and parameters Lloyd Zusman
2006-05-12 23:09                   ` Vincent Lefevre
2006-05-13  2:05                     ` Lloyd Zusman
2006-05-17 14:24                       ` Vincent Lefevre
2006-05-17 15:42                         ` Bart Schaefer
2006-05-17 16:07                           ` Vincent Lefevre
2006-05-13  2:10                     ` Dan Nelson
2006-05-11 16:13             ` File locking within zsh? Brian K. White
2006-05-10 17:13     ` Vincent Lefevre
2006-05-11 15:45       ` Brian K. White
2006-05-12  7:54         ` Vincent Lefevre
2006-05-12 19:40           ` Tim Writer
2006-05-12 23:24             ` Vincent Lefevre
2006-05-10 21:53     ` Tim Writer
2006-05-10  6:29 ` DervishD
2006-05-10 10:02   ` Lloyd Zusman
2006-05-10 21:21     ` DervishD

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).