Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
trigger prexec function from a script
- X-seq: zsh-users 17824
- From: Eric Smith <Eric.Smith@xxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: trigger prexec function from a script
- Date: Fri, 7 Jun 2013 11:47:11 +0200
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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