#!/usr/bin/env bash if [[ -e "/dev/fd/${XSS_SLEEP_LOCK_FD:--1}" ]]; then pid="$(slock -kfp {XSS_SLEEP_LOCK_FD}<&-)" trap "kill ${pid}" TERM INT exec {XSS_SLEEP_LOCK_FD}<&- waitpid "${pid}" & wait else trap 'kill %%' TERM INT slock -k & wait fi