dotfiles/utils/.local/bin/exec-if-exists

15 lines
195 B
Bash
Executable File

#!/bin/sh
set -e
if command -v "$1" >/dev/null; then
exec "$@" 2>&1
else
echo "$1 not found"
if [ -n "$NOEXISTFAIL" ]; then
exit 1
else
exec sleep 999
fi
fi