#!/bin/zsh
######################################################################
link=$1
## Arg must be nonempty and refer to a symlink.
[[ -n $link && -h $link ]] || return
## Target of symlink must exist, and not be a directory or symlink.
target=$(readlink $link)
[[ -a $target ]] || return
[[ -h $target || -d $target ]] && return
## Force the new link to replace the symlink.
ln -f $target $link
######################################################################
# END
######################################################################