#!/bin/bash lockfile-create $1 while IFS='$\n' read -r line; do # do whatever with line tmux send-keys -t $1 "$line" "C-m" done lockfile-remove $1