From 620b628ba58a44734fa84691506355b7d6807473 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Tue, 2 Nov 2021 12:00:43 +0000 Subject: [PATCH] bin: little elevation fix --- .local/bin/scripts/dif | 1 - .local/bin/scripts/m | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.local/bin/scripts/dif b/.local/bin/scripts/dif index bbd39bc..68d454d 100755 --- a/.local/bin/scripts/dif +++ b/.local/bin/scripts/dif @@ -1,5 +1,4 @@ #!/bin/sh # interactive diff with pagination and nice coloring -set -o pipefail diff-color --report-identical-files "$@" | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen diff --git a/.local/bin/scripts/m b/.local/bin/scripts/m index 931fff1..23d0aab 100755 --- a/.local/bin/scripts/m +++ b/.local/bin/scripts/m @@ -3,7 +3,7 @@ # and moves the preceding arguments into it. # Automatically elevates if missing permissions. for last; do true; done -! test -e "$1" && echo "$1 does not exist" && exit 1 checkaccess -w "$@" || elevate=sudo +! $elevate test -e "$1" && echo "$1 does not exist" && exit 1 $elevate mkdir -p $(case "$last" in (*/) echo "$last";; (*) dirname "$last";; esac) $elevate mv --interactive "$@"