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

trigger prexec function from a script



Oh Zshellers,

I have a prexec function and this works fine when I put a
filename on the prompt and press enter. How do I make the preexec
fire when I deliver the command from script?

FWIW;
function preexec {
local cmd
local application
cmd=(${(Q)${(z)3}})
if [[ $cmd[1] == (*foo) ]]; then
    application=bar
fi
if [ $application ];then
    eval "function ${(q)cmd[1]} {
        unsetopt noglob
        $application $url${(q)cmd[1]}" '$*
          return
        unfunction' "${(q)cmd[1]}
    }"
setopt noglob
fi

-- 
Eric Smith



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