zsh-users
 help / color / mirror / code / Atom feed
* trigger prexec function from a script
@ 2013-06-07  9:47 Eric Smith
  2013-06-07 10:16 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Smith @ 2013-06-07  9:47 UTC (permalink / raw)
  To: Zsh Users

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-07 10:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-07  9:47 trigger prexec function from a script Eric Smith
2013-06-07 10:16 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).