From 10536a6b1bc09f350d675adc5f692b0cd8866e4f Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sun, 12 Dec 2021 11:35:36 +0100 Subject: [PATCH] bin: adjust rd --- .local/bin/scripts/arg-test | 2 +- .local/bin/scripts/rd | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.local/bin/scripts/arg-test b/.local/bin/scripts/arg-test index 08fa481..79977b4 100755 --- a/.local/bin/scripts/arg-test +++ b/.local/bin/scripts/arg-test @@ -1,6 +1,6 @@ #!/bin/sh { -echo "$# Args: $@" +echo "$# Args: ${@:-DEFAULT}" #echo "Starred: $*" #echo "${@:-default}" | sed 's/\w\+/\0-w/g' for last; do true; done diff --git a/.local/bin/scripts/rd b/.local/bin/scripts/rd index 7ae973c..a084ee5 100755 --- a/.local/bin/scripts/rd +++ b/.local/bin/scripts/rd @@ -1,7 +1,7 @@ #!/bin/sh # Remove recursively safely case "$1" in ([0-9]) depth=$1; shift;; esac -for f in "$@" +for f in "${@-.}" do test -w "$f" && elevate="" || elevate=sudo if test -d "$f"; then @@ -17,5 +17,4 @@ do fi else $elevate rm -i "$f" fi - shift done