From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13640 invoked by alias); 13 Oct 2011 03:22:44 -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: 16475 Received: (qmail 13175 invoked from network); 13 Oct 2011 03:22:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.220.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=p1txMHcRDOyY2Rawz+5xG489pxZE8RwyUa2N1PHBTtk=; b=D7OfY6xvyRvCQfJcJlSvI7ErH9BB0nKK7dxTqA0MVlQ6ExIcQgu1zqS2xvT079/BfY gFrbZeXqkdmyrm1MCM173DYqQFLnWDHWpYS/qsxqj3d4MAlqj6D8juzDDE6c1fWBm6AX 6YaOEBqGMhA0XL657RvqhwUWjl7Kz/mPASspM= Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: Would like an alias to read the part of the current command line that precedes the alias From: Aaron Davies In-Reply-To: <111010190517.ZM5763@torch.brasslantern.com> Date: Wed, 12 Oct 2011 23:15:49 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <5F28EC71-35D4-45EF-9F75-FE853DF420BA@gmail.com> References: <20111010231518.BFD1A10E2AA@smtp.hushmail.com> <111010190517.ZM5763@torch.brasslantern.com> To: zsh-users@zsh.org X-Mailer: Apple Mail (2.1084) On Oct 10, 2011, at 10:05 PM, Bart Schaefer wrote: > However, I suspect most zsh users would do this with a precmd = function, > and never type out the "; alert" at all. For example: Here's my attempt to build a version for Mac. I'm having two problems: First, and I think this is general, it triggers again off of a blank = command line (i.e. pressing return a second time) after the specified = time has elapsed. This is the second growlnotify call below. Second, and this is probably due to my setup, I can't get the failure = detection working. The third growlnotify call below should have a -a = argument of "Problem Reporter". Any idea what I'm doing wrong? pro% echo $ZSH_VERSION=20 4.3.9 pro% setopt extendedglob interactive login monitor shinstdin zle pro% typeset -f preexec precmd preexec () { SECONDS=3D0=20 } precmd () { (( SECONDS > 1 )) && growlnotify -p "Very Low" -a = "${${?/0/Terminal}//<->*/Problem Reporter}" -m $history[$[HISTCMD-1]] } pro% cat succeed=20 #!/bin/zsh sleep 2 pro% cat fail=20 #!/bin/zsh sleep 2 exit 1 pro% set -x +precmd:1> (( SECONDS > 1 )) pro% ./succeed=20 +preexec:1> SECONDS=3D0=20 +-zsh:7> ./succeed +precmd:1> (( SECONDS > 1 )) +precmd:3> growlnotify -p 'Very Low' -a Terminal -m ./succeed pro%=20 +precmd:1> (( SECONDS > 1 )) +precmd:3> growlnotify -p 'Very Low' -a Terminal -m ./succeed pro% ./fail=20 +preexec:1> SECONDS=3D0=20 +-zsh:9> ./fail +precmd:1> (( SECONDS > 1 )) +precmd:3> growlnotify -p 'Very Low' -a Terminal -m ./fail pro%=20 --=20 Aaron Davies aaron.davies@gmail.com=