From 6894c4eb44862cfee1e907f5d5fe87e70f40b81b Mon Sep 17 00:00:00 2001 From: Michele Renda Date: Fri, 7 Apr 2017 13:18:46 +0300 Subject: [PATCH] Fixed problem with multilevel path --- plugins/nohup/nohup.plugin.zsh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/nohup/nohup.plugin.zsh b/plugins/nohup/nohup.plugin.zsh index 8a4d25bf..b723e4c5 100644 --- a/plugins/nohup/nohup.plugin.zsh +++ b/plugins/nohup/nohup.plugin.zsh @@ -18,14 +18,12 @@ nohup-command-line() { BUFFER="${BUFFER#nohup }" BUFFER="${BUFFER%\ &\>*}" else - tokens_slash=("${(@s|/|)BUFFER}") + base="${BUFFER#sudo }" + tokens_slash=("${(@s|/|)base}") tokens_space=("${(@s/ /)tokens_slash[-1]}") - i=1 - if [[ $tokens_slash[1] == sudo ]]; then - (( i++ )) - fi + command=("$tokens_space[1]") - BUFFER="nohup $BUFFER &> $tokens_space[$i].out &" + BUFFER="nohup $BUFFER &> $command.out &" fi } zle -N nohup-command-line