Skip to content

Commit e6e3f45

Browse files
committed
revert: remove find_symlinks function
because: - we should not attempt to build our own tool to find every symbolic link to a file and - `find . -type l` finds symlinks Signed-off-by: Lucas Larson <LucasLarson@riseup.net>
1 parent feb77f0 commit e6e3f45

1 file changed

Lines changed: 0 additions & 41 deletions

File tree

custom/aliases.sh

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3325,47 +3325,6 @@ find_smallest_files() {
33253325
)"} - 3))" "${@-}"
33263326
}
33273327

3328-
find_symlinks() {
3329-
# find all symlinks to a file
3330-
# https://stackoverflow.com/a/6185052
3331-
# command sudo -- find -L -- / -samefile /usr/local/Cellar/rbenv/1.2.0/completions/rbenv.zsh 2>/dev/null
3332-
3333-
set \
3334-
-o verbose \
3335-
-o xtrace
3336-
# GPT
3337-
target="$(command realpath -- "${1-}")"
3338-
export target
3339-
command find -L -- "${2:-.}" \
3340-
-exec sh -c -- 'test "$(realpath -- "${1-}")" = "${target-}" && printf -- '\''%s\n'\'' "${1-}"' _ {} ';'
3341-
{
3342-
set \
3343-
+o verbose \
3344-
+o xtrace
3345-
} 2>/dev/null
3346-
unset target >/dev/null 2>&1 || target=''
3347-
3348-
printf -- 'all symlinks to and from files in this directory or its subdirectories\n' >&2
3349-
command find -L -- . \
3350-
-type l \
3351-
-exec find -L -- . -samefile {} ';' \
3352-
-exec printf -- '\n' ';' 2>&1 |
3353-
while IFS='' read -r -- file; do
3354-
command ls -A -F -g -o --color=always -- "${file-}" 2>&1 |
3355-
sed -e '/: No such file or directory/d'
3356-
done
3357-
3358-
test "${#}" -gt 0 ||
3359-
return 0
3360-
printf -- 'all symlinks in the current directory or below to the specific file %s\n' "${1-}" >&2
3361-
command find -L -- . -samefile "${1-}" 2>/dev/null
3362-
3363-
test "${#}" -gt 1 ||
3364-
return 0
3365-
printf -- 'all symlinks in all directories to the specific file %s\n' "${2-}" >&2
3366-
command find -L -- / -samefile "${2-}" 2>/dev/null
3367-
}
3368-
33693328
find_text_files() {
33703329
{
33713330
command find -- . \

0 commit comments

Comments
 (0)