Invoke cd in subshell
This commit is contained in:
parent
85f230bd8f
commit
3c76c63b5b
|
|
@ -75,7 +75,7 @@ function __zoxide_z() {
|
||||||
echo 'zoxide: $OLDPWD is not set'
|
echo 'zoxide: $OLDPWD is not set'
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
elif [ "$#" -eq 1 ] && [ -d "$1" ]; then
|
elif [ "$#" -eq 1 ] && (cd "$1" &>{{ Opts::DEVNULL }}); then
|
||||||
__zoxide_cd "$1"
|
__zoxide_cd "$1"
|
||||||
else
|
else
|
||||||
local __zoxide_result
|
local __zoxide_result
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ __zoxide_z() {
|
||||||
echo 'zoxide: $OLDPWD is not set'
|
echo 'zoxide: $OLDPWD is not set'
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
elif [ "$#" -eq 1 ] && [ -d "$1" ]; then
|
elif [ "$#" -eq 1 ] && (cd "$1" >{{ Opts::DEVNULL }}) 2>&1; then
|
||||||
__zoxide_cd "$1"
|
__zoxide_cd "$1"
|
||||||
else
|
else
|
||||||
__zoxide_result="$(zoxide query -- "$@")" && __zoxide_cd "${__zoxide_result}"
|
__zoxide_result="$(zoxide query -- "$@")" && __zoxide_cd "${__zoxide_result}"
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,9 @@ function __zoxide_z() {
|
||||||
echo "zoxide: \\$OLDPWD is not set"
|
echo "zoxide: \\$OLDPWD is not set"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
elif ! { [ "$#" -eq 1 ] && __zoxide_cd "$1" &>{{ Opts::DEVNULL }}; }; then
|
elif [ "$#" -eq 1 ] && (cd "$1" &>{{ Opts::DEVNULL }}) then
|
||||||
|
__zoxide_cd "$1"
|
||||||
|
else
|
||||||
local __zoxide_result
|
local __zoxide_result
|
||||||
__zoxide_result="$(zoxide query -- "$@")" && __zoxide_cd "$__zoxide_result"
|
__zoxide_result="$(zoxide query -- "$@")" && __zoxide_cd "$__zoxide_result"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue