aboutsummaryrefslogtreecommitdiffstats
path: root/tools/getlinks
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-02-10 07:05:52 +0100
committerMattias Andrée <maandree@kth.se>2024-02-10 07:05:52 +0100
commitc90e3bf08b1c6f4426d0f72c76b1ac9a0a346efb (patch)
treef9a0216e5e7d2a0a77d40a1840a1f6b3424869d2 /tools/getlinks
parentAdd alias for versions up to 99 of applications (diff)
downloadsimple-icon-theme-c90e3bf08b1c6f4426d0f72c76b1ac9a0a346efb.tar.gz
simple-icon-theme-c90e3bf08b1c6f4426d0f72c76b1ac9a0a346efb.tar.bz2
simple-icon-theme-c90e3bf08b1c6f4426d0f72c76b1ac9a0a346efb.tar.xz
Add tools
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rwxr-xr-xtools/getlinks19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/getlinks b/tools/getlinks
new file mode 100755
index 0000000..b1a376a
--- /dev/null
+++ b/tools/getlinks
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+if test $# = 0; then
+ dir=.
+else
+ dir="$1"
+ shift 1
+fi
+
+dirlen="${#dir}"
+find "$dir" | xtest -L "$@" | colrm 1 $dirlen | sed 's/^\/*//' | while read f; do
+ L="$(printf '%s\n' "$f" | rev | cut -d . -f 2- | rev)"
+ T="$(dirname -- "$L")/$(readlink -- "$dir/$f" | rev | cut -d . -f 2- | rev)"
+ T="$(printf '%s\n' "$T" | sed 's:/\(./\)*:/:g')"
+ while printf '%s\n' "$T" | grep '/../' > /dev/null; do
+ T="$(printf '%s\n' "$T" | sed 's:[^/]*/\.\./::')"
+ done
+ printf '%s\n\t%s\n' "$T" "$L"
+done