[SOLVED] Is there any mutex/semaphore mechanism in shell scripts?


I’m looking for mutex/semaphore/concurrency mechanism in shell script.
Consider following situation:
Unless “a” user does not close the shared file, “b” user should not able to open/update it.
I’m just wondering how to implement mutex, semaphore, critical sections, etc. in shell scripting.

Which is the easiest way to implement locking mechanism [file level] in shell scripting?


See BashFAQ and ProcessManagment for discussions on file locking in Bash.

Tagging your question as shell (only) limits the number of people that can help you. You may want to add unix, ksh, bash.

There are numerous questions/answers on this topic posted here already on S.O.

I hope this helps.

Answered By – shellter

Answer Checked By – Clifford M. (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.