set -u
link_to() {
- rm -rf "$1"
+ rm -r "$1"
ln -s "$2" "$1"
}
for pkg in "$package_base"/*/*.git; do
case "$pkg" in
- "$package_base/packages/*.git") link_to "$pkg/hooks" "$hook_base/sub" ;;
+ "$package_base"/packages/*.git) link_to "$pkg/hooks" "$hook_base/sub" ;;
*) link_to "$pkg/hooks" "$hook_base/other" ;;
esac
done