Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

How to prevent alias expansion



Hi,

I've a problem with alias expansion. When using run-help and an global
alias for redirect to /dev/null the command fails.

% alias -g DN='>/dev/null'
% git show DN<ESC h>
<empty output>

I propose this patch:
commit f7d81342f5d1a17879cbee0c2d0e602451f21e19
Author: JÃrg Sommer <joerg@xxxxxxxxxxxx>
Date:   Sun Jan 4 16:50:00 2009 +0100

    Doubleâquote the argument of specialized run-help functions
    
    Quoting the arguments of the run-help-$CMD functions only one time makes
    eval expands them. In the case of a global alias DN='>/dev/null' the
    output of the functions gets redirected to /dev/null, which is bad.
    
    % alias -g DN='>/dev/null'
    % run-help-foo () { echo bar; }
    % foo <ESC h>
    foo not found
    bar
    % foo DN<ESC h>
    foo not found
    %

diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help
index f8aef0d..d0c3efe 100644
--- a/Functions/Misc/run-help
+++ b/Functions/Misc/run-help
@@ -101,7 +101,7 @@ do
 		do
 		    shift cmd_args
 		done
-		eval "run-help-$1:t ${(q@)cmd_args[2,-1]}"
+		eval "run-help-$1:t ${(qq@)cmd_args[2,-1]}"
 	    else
 		man $@:t
 	    fi

Bye, JÃrg
-- 
Stasi 2.0 â http://www.dataloo.de/stasi-20-525.html



Messages sorted by: Reverse Date, Date, Thread, Author