#!/bin/bash

set -euo pipefail

inotifywait \
	--monitor button-target.txt \
	--event ACCESS \
	--format %T --timefmt %s \
| while read timestamp; do
	printf 'Accessed at %s.\n' "$timestamp";
	printf %s "$timestamp" > last-access.txt;
done
