Skip to main content
3 of 3
Make the title preciser
Marlon Richert
  • 4.3k
  • 11
  • 38

Code works in bash, not in zsh -- flock on arbitrary fd

Am new to shell scripting, and it makes me wonder why the following snippet does not work in zsh but does in bash? Is there a zsh equivalent of the same snippet? I get error parse error near `200'

( 
  flock -e 200
  echo "In critical section"
  sleep 5 
) 200>/tmp/blah.lockfile 
echo "After critical section"

The above snippet of code is from src: https://stackoverflow.com/a/13551882/15087532

codepoet
  • 636
  • 6
  • 19