bin: little elevation fix
This commit is contained in:
parent
d0e8310c94
commit
620b628ba5
|
@ -1,5 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# interactive diff with pagination and nice coloring
|
# interactive diff with pagination and nice coloring
|
||||||
set -o pipefail
|
|
||||||
diff-color --report-identical-files "$@" |
|
diff-color --report-identical-files "$@" |
|
||||||
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
|
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# and moves the preceding arguments into it.
|
# and moves the preceding arguments into it.
|
||||||
# Automatically elevates if missing permissions.
|
# Automatically elevates if missing permissions.
|
||||||
for last; do true; done
|
for last; do true; done
|
||||||
! test -e "$1" && echo "$1 does not exist" && exit 1
|
|
||||||
checkaccess -w "$@" || elevate=sudo
|
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 mkdir -p $(case "$last" in (*/) echo "$last";; (*) dirname "$last";; esac)
|
||||||
$elevate mv --interactive "$@"
|
$elevate mv --interactive "$@"
|
||||||
|
|
Loading…
Reference in New Issue