#!/usr/bin/env bash file=/tmp/vm-switch.txt # Ensure the file exists touch "$file" echo "Listening on $file ..." tail -n0 -F "$file" | while read vm; do [ -n "$vm" ] && echo "Switch requested: $vm" && ~/bin/work "$vm" & done