

You want ++OK, actually not exactly. readlink -f
rather than ls -l
.readlink
won’t print path to the symlink so it’s not as straightforward.++
Also, you want +
in find ... -exec ... +
rather than ;
.
At this point I feel committed to making readlink work. ;) Here’s the script you want:
#!/bin/sh
want=$1
shift
readlink -f -- "$@" | while read got; do
if [ "$got" = "$want" ]; then
echo "$1"
fi
shift
done
and execute it as:
find ~ -type l -exec /bin/sh /path/to/the/script /path/to/target/dir {} +
You could pass
$1
and$got
through$(realpath -P -- ...)
to make sure all the path are in canonical form. Though now that I’m thinking about it,stat
is probably a better option anyway: