Merge 71500c1699c9c50ba3fdeb951a565a086d727b4c into f853f1884a8f0c244765192dc6f5a910a7e2b8e5

This commit is contained in:
Peter MacKenzie-Basaraba 2025-04-11 16:53:51 -06:00 committed by GitHub
commit f0c1f33e90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,4 +9,10 @@
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
base="$(basename "$1")"
ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'
case "$base" in
.*) ls_opt="ls -a" ;;
*) ls_opt="ls" ;;
esac
$ls_opt "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'