mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-02-05 09:00:23 +01:00
do not resolve command to absolute path
it breaks commands e.g. sudo -u http echo foobar as http is both a command (httpie) and a user/group (httpd) in my system
This commit is contained in:
@@ -17,14 +17,10 @@ function _do_sudo() {
|
|||||||
noglob) __do_sudo_glob=0; shift ;;
|
noglob) __do_sudo_glob=0; shift ;;
|
||||||
*)
|
*)
|
||||||
cmd_alias="$(command -v 2>/dev/null -- "$1")"
|
cmd_alias="$(command -v 2>/dev/null -- "$1")"
|
||||||
if [[ "$?" -eq 0 ]]; then
|
if [[ "$?" -eq 0 ]] && [[ "$cmd_alias" == 'alias'* ]] && [[ -z "$__do_sudo_expanded["$1"]" ]]; then
|
||||||
if [[ "$cmd_alias" == 'alias'* ]] && [[ -z "$__do_sudo_expanded["$1"]" ]]; then
|
__do_sudo_expanded["$1"]=1
|
||||||
__do_sudo_expanded["$1"]=1
|
IFS=' ' read -A cmd_alias_arr <<< "$(sed -e "s/[^=]*=//" -e "s/^'//" -e "s/'$//" <<< "$cmd_alias")"
|
||||||
IFS=' ' read -A cmd_alias_arr <<< "$(sed -e "s/[^=]*=//" -e "s/^'//" -e "s/'$//" <<< "$cmd_alias")"
|
args+=( "${cmd_alias_arr[@]}" )
|
||||||
args+=( "${cmd_alias_arr[@]}" )
|
|
||||||
else
|
|
||||||
args+=( "$(sed "s/[^=]*=//" <<< "$(hash -v 2>/dev/null -- "$1")")" )
|
|
||||||
fi
|
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user