Fixed problem with multilevel path

This commit is contained in:
Michele Renda 2017-04-07 13:18:46 +03:00
parent 606ea84e60
commit 6894c4eb44

View File

@ -18,14 +18,12 @@ nohup-command-line() {
BUFFER="${BUFFER#nohup }" BUFFER="${BUFFER#nohup }"
BUFFER="${BUFFER%\ &\>*}" BUFFER="${BUFFER%\ &\>*}"
else else
tokens_slash=("${(@s|/|)BUFFER}") base="${BUFFER#sudo }"
tokens_slash=("${(@s|/|)base}")
tokens_space=("${(@s/ /)tokens_slash[-1]}") tokens_space=("${(@s/ /)tokens_slash[-1]}")
i=1 command=("$tokens_space[1]")
if [[ $tokens_slash[1] == sudo ]]; then
(( i++ ))
fi
BUFFER="nohup $BUFFER &> $tokens_space[$i].out &" BUFFER="nohup $BUFFER &> $command.out &"
fi fi
} }
zle -N nohup-command-line zle -N nohup-command-line