#!/bin/bash
#                       /usr/local/bin/delete_symlink_target
# https://crystalfaeries.net/posix/bin/delete_symlink_target
# celeste@crystalfaeries.net DELETE_SYMLINK_TARGET 2021-03-16 01:30:43+00:00
# accept a path to a symlink, follow the link to its target, and delete that target
while [[ $# -gt 0 ]]
do
	delete -i $( ls -l "${1}" | sed 's/^.* \//\//;s/\/[^\/]* -> /\//' ) || exit $?
	shift
done
exit	$?
