title: Is flock automatically released on process exit?
body: <p>In a bash script in Linux, I am using flock [the command flock, not the system call flock()] to implement file locking thereby guarding concurrent access against a shared resource [which is a file in tmpfs]. </p>
  
  <p>I have trap handlers to handle abnormal termination of my script:
  <code>trap "{ rm -rf $LOCK ; rm -rf $TMPFS_FILE; exit 255; }" SIGINT SIGTERM</code></p>
  
  <p>where $LOCK is my lock file and $TMPFS_FILE is my shared resource.</p>
  
  <p>My question is do I need to explicitly do a file unlock as well ? Or does Linux do it for me upon all program termination [both voluntary termination as well as forced] scenarios ?</p>