#!/bin/sh -e
#
# whenexits - run a command when another process exits, selecting the process via fzf

waiting_on=$(ps aux | fzf | awk '{ print $2 }')
watch -g ps -opid -p "${waiting_on}"; "$@"
