X-Git-Url: https://git.distorted.org.uk/~mdw/cfd/blobdiff_plain/87eaf275d4957b93583b9dcfb71d06f798533aca..de8440cea07259aadd308a01cf5f3247647514b7:/findlinks.in diff --git a/findlinks.in b/findlinks.in index 2790b92..fbbcd98 100755 --- a/findlinks.in +++ b/findlinks.in @@ -59,7 +59,6 @@ done ###-------------------------------------------------------------------------- ### Read the names of all the files I support. ### -### ### Yes, this is ugly and hacky: well spotted. Shells have a nasty habit of ### spontaneously forking when redirection gets too hard for them to think ### about, so instead of something nice along the lines of @@ -74,14 +73,14 @@ done ### the pattern match in the `case' below work properly. files=$( - files="" + files=: find "$pkgdatadir" -type f -print | { while read name; do - files="$files:$(echo "$name" | sed 's;^.*/;;')" + files="$files${name##*/}:" done - echo $files + echo "$files" } -): +) ###-------------------------------------------------------------------------- ### Now examine the current directory. @@ -90,13 +89,13 @@ files=$( ### say `findlinks >.links' without any problems. find . \( -type f -o -type l \) -print | while read name; do - base="$(echo "$name" | sed 's;^.*/;;')" + base=${name##*/} case "$files" in - *:$base:*) - echo $name + *:"$base":*) + echo "${name#./}" ;; *) esac -done | sed 's,^\./,,' | sort +done | sort ###----- That's all, folks --------------------------------------------------