From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1949 invoked from network); 13 Aug 2003 13:22:44 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 13 Aug 2003 13:22:44 -0000 Received: (qmail 26970 invoked by alias); 13 Aug 2003 13:22:21 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6463 Received: (qmail 26628 invoked from network); 13 Aug 2003 13:20:41 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 13 Aug 2003 13:20:41 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.58.69.233] by sunsite.dk (MessageWall 1.0.8) with SMTP; 13 Aug 2003 13:20:41 -0000 Received: by cherry.fruitcom.com (Postfix, from userid 1000) id 96E6757C62; Wed, 13 Aug 2003 15:14:31 +0200 (CEST) Date: Wed, 13 Aug 2003 15:14:30 +0200 From: Eric Smith To: Zsh Users Subject: preexec function to work after `&&' Message-ID: <20030813131429.GA2413@fruitcom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.3i Hi This mime type like preexec makes life a lot more convenient (for me anyways) by automatically launching the given file with the associated application - but it don't work in a compound command like sleep 1 && some.pdf (or whatever the file happens to be). How might I fix this? And while you are at it (if you are), how could I introduce case insensitivity on the suffixes. thank you.... function preexec { local cmd local application cmd=(${(Q)${(z)3}}) if [[ $cmd[1] == (https*://*|http://|www.*.*|*.(html|HTML)) ]]; then application=w3m elif [[ $cmd[1] == (*README*|*readme*|*.(svg|draft|conf|txt|xsl|xml|mail|csv)) ]]; then application=vim elif [[ $cmd[1] == *.(pdf|PDF) ]]; then application=acroread elif [[ $cmd[1] == *.(ps|PS) ]]; then application=gv elif [[ $cmd[1] == *.(gif|jpg|jpeg|tif|tiff|png) ]]; then application=display elif [[ $cmd[1] == *.(xls) ]]; then application=ooffice url=file:/// elif [[ $cmd[1] == *.(gz|GZ) ]]; then application=zless elif [[ $cmd[1] == *.(doc) ]]; then application=abiword elif [[ $cmd[1] == *.(rtf|RTF) ]]; then application=ted fi if [ $application ];then eval "function ${(q)cmd[1]} { unsetopt noglob $application $url${(q)cmd[1]}" '$* unfunction' "${(q)cmd[1]} }" setopt noglob fi -- Eric Smith