Skip to content

Commit

Permalink
setup.sh: fix -f for overwriting non-symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
huyz committed Dec 10, 2024
1 parent 920f30d commit 0b57210
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ function symlink {
return 0
fi
elif [[ -e "$link_name" ]]; then
echo "$SCRIPT_NAME: error: $link_name already exists" >&2
return 1
if [[ -z $opt_force ]]; then
echo "$SCRIPT_NAME: error: non-symlink $link_name already exists" >&2
return 1
else
echo "$SCRIPT_NAME: warning: non-symlink $link_name already exists. Overwriting…" >&2
fi
fi

echo ln -s$opt_force "$1" "$2"
Expand Down

0 comments on commit 0b57210

Please sign in to comment.