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

Code works in bash, not in zsh -- flock and parentheses groupingon arbitrary fd

edited title
Link
codepoet
  • 636
  • 6
  • 19

Code works in bash, not in zsh -- flock and parentheses grouping

Source Link
codepoet
  • 636
  • 6
  • 19

Code works in bash, not in zsh -- parentheses grouping

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