From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26088 invoked by alias); 7 Jun 2013 09:56:29 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17824 Received: (qmail 5822 invoked from network); 7 Jun 2013 09:55:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at trustfood.org does not designate permitted sender hosts) Date: Fri, 7 Jun 2013 11:47:11 +0200 From: Eric Smith To: Zsh Users Subject: trigger prexec function from a script Message-ID: <20130607094711.GA29399@trustfood.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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