dotfiles/lib/lib.sh

20 lines
238 B
Bash
Raw Normal View History

2023-10-14 22:38:03 +02:00
#!/bin/sh
DRY_RUN=${DRY_RUN:-no}
bool() {
case "$1" in
1|true|yes|on|TRUE|YES|ON) return 0 ;;
*) return 1 ;;
esac
}
run() {
if bool "$DRY_RUN"; then
echo "DRY: + $*"
else
echo "+ $*"
"$@"
fi
}