From 4f097b4cb95f948fe1c2673d6fcef7fe5e56686b Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 31 Mar 2024 00:50:07 -0500 Subject: [PATCH] Simplify record-commands a little. --- mkroot/record-commands | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/mkroot/record-commands b/mkroot/record-commands index 6e63c5b7..32557a3e 100755 --- a/mkroot/record-commands +++ b/mkroot/record-commands @@ -16,13 +16,11 @@ if [ ! -x "$WRAPDIR/logpath" ] then mkdir -p "$WRAPDIR" || exit 1 [ -e "$(which logpath)" ] && cp -H "$(which logpath)" "$WRAPDIR/logpath" || - mkdir -p "$WRAPDIR" && PREFIX="$WRAPDIR/" scripts/single.sh logpath || - exit 1 - find $(tr : '\n' <<< "$PATH") -type f,l -maxdepth 1 -executable \ - -exec basename {} \; | while read FILE - do - ln -s logpath "$WRAPDIR/$FILE" 2>/dev/null - done + PREFIX="$WRAPDIR/" scripts/single.sh logpath || exit 1 + tr : '\n' <<< "$PATH" | while read i; do + find "$i" -type f,l -maxdepth 1 -executable -exec basename {} \; | \ + while read FILE; do ln -s logpath "$WRAPDIR/$FILE" 2>/dev/null; done + done fi # Delete old log (if any) @@ -34,8 +32,7 @@ if [ ${#BASH_SOURCE[@]} -lt 2 ] then "$@" X=$? - - [ ! -z "$RM" ] && "$RM" -rf "$WRAPDIR" + [ -n "$RM" ] && "$RM" -rf "$WRAPDIR" exit $X fi -- 2.39.2