this is the standard approach to create locks using file system. For example, visudo uses it:
[ -f ".lock" ] && exit 1
touch .lock
# do something
rm .lock
1) I'm confused, for there's a race condition, yet Linux uses it
2) is there a better way to lock on files from shell?
3) or do I have to use directories instead?
Found solution: man lockfile.