bin/b: fix sudo prompt for paths with spaces
This commit is contained in:
parent
653526346f
commit
b73a5d7e37
|
@ -7,8 +7,10 @@ set -eo pipefail
|
|||
for last; do true; done
|
||||
last=${last:-.}
|
||||
|
||||
# Elevate permissions if the file exists but is not accessible
|
||||
test -x "$(dirname $last)" && { test -r "$last" || ! test -e "$last"; } || elevate=sudo
|
||||
# Elevate permissions if the file is not accessible
|
||||
test -x "$(dirname "$last")" &&
|
||||
{ test -r "$last" || ! test -e "$last"; } ||
|
||||
elevate=sudo
|
||||
tput setaf 4 && $elevate file -E "$last" | ( grep -v --color=never 'directory$' || true )
|
||||
|
||||
case "$($elevate file --dereference --mime "$last")" in
|
||||
|
|
Loading…
Reference in New Issue