Sometimes we need limit the access to some system resources or files. We want to be sure that the only one process to have an access to them in the same time. This short article explains how to use exclusive locks in shell scripts.
Assume we have a shell script (‘writer.sh‘) which writes an output file (‘output.txt‘). It writes the file line by line with one second delay between each line.