diff options
-rwxr-xr-x | bosun | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -61,13 +61,14 @@ list() { } list_active() { - # Note: we de not escape any special characters in $STOW_DIR since it is - # assumed we are in full control of its contents. - # XXX: -r for xargs is a GNU extension - find "$STOW_DIR/.." -type l -print0 2>/dev/null \ - | xargs -r0 readlink -f \ - | sed -n ":^$STOW_DIR: s:^$STOW_DIR/\([^/]\+\)/.*:\1:p" \ - | sort -u + real=$(realpath "$STOW_DIR") + cd "$STOW_DIR/.." || exit 1 + + # XXX: GNU extensions: -print0 for find, -r -0 for xargs + # XXX: GNU only: realpath + find -type l -print0 2>/dev/null \ + | xargs -r0 realpath -e --relative-base "$real" 2>/dev/null \ + | sed '/^\//d' | cut -d/ -f1 | sort -u } list_all() { |