mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
attempt to fix permissions problem
when you "su", the prompt_command can stay set, even without autojump getting sourced. Then the user's autojump file changes owner, and a disaster ensues. This is an attempt to fix this problem.
This commit is contained in:
parent
d9010198ef
commit
d50de9196a
@ -27,6 +27,7 @@ _autojump()
|
|||||||
complete -F _autojump j
|
complete -F _autojump j
|
||||||
#data_dir=${XDG_DATA_HOME:-$([ -e ~/.local/share ] && echo ~/.local/share || echo ~)}
|
#data_dir=${XDG_DATA_HOME:-$([ -e ~/.local/share ] && echo ~/.local/share || echo ~)}
|
||||||
data_dir=$([ -e ~/.local/share ] && echo ~/.local/share || echo ~)
|
data_dir=$([ -e ~/.local/share ] && echo ~/.local/share || echo ~)
|
||||||
|
export AUTOJUMP_HOME=${HOME}
|
||||||
if [[ "$data_dir" = "${HOME}" ]]
|
if [[ "$data_dir" = "${HOME}" ]]
|
||||||
then
|
then
|
||||||
export AUTOJUMP_DATA_DIR=${data_dir}
|
export AUTOJUMP_DATA_DIR=${data_dir}
|
||||||
@ -41,7 +42,7 @@ then
|
|||||||
mv ~/.autojump_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null
|
mv ~/.autojump_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AUTOJUMP='{ (autojump -a "$(pwd -P)"&)>/dev/null 2>>${AUTOJUMP_DATA_DIR}/autojump_errors;} 2>/dev/null'
|
AUTOJUMP='{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>${AUTOJUMP_DATA_DIR}/autojump_errors;} 2>/dev/null'
|
||||||
if [[ ! $PROMPT_COMMAND =~ autojump ]]; then
|
if [[ ! $PROMPT_COMMAND =~ autojump ]]; then
|
||||||
export PROMPT_COMMAND="${PROMPT_COMMAND:-:} ; $AUTOJUMP"
|
export PROMPT_COMMAND="${PROMPT_COMMAND:-:} ; $AUTOJUMP"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user