zsh-users
 help / color / mirror / code / Atom feed
From: Borzenkov Andrey <Andrey.Borzenkov@siemens.com>
To: "'Aidan Kehoe'" <kehoea@parhasard.net>, zsh-users@sunsite.dk
Subject: RE: Dynamically adding to $mailpath?
Date: Thu, 19 Dec 2002 14:42:23 +0300	[thread overview]
Message-ID: <6134254DE87BD411908B00A0C99B044F03A0B5AC@MOWD019A> (raw)
In-Reply-To: <15873.44013.976882.301072@gargle.gargle.HOWL>


> Should this;
> 
>   typeset -a mailpath
>   for i in ~/mail/*.spool; do
>     set $mailpath[$#mailpath+1]="${i}?You have new mail in $(basename $i
> .spool).";
>   done
> 
> have worked? 

No; 

1. $mailpath[$#mailpath+1] is evaluated before even trying to execute
anyting so the above is the same as

set ="{i}..."

2. set foo[bar] is wrong for setting any variable anyway

3. you do not need basename in zsh, it does it internally.


I got around it by using $MAILPATH, but
> 
>   zsh: /home/hcksplat/mail/X.spool?You have new mail in X. not found
>   $
> 
> doesn't seem right to me. ZSH_VERSION=4.0.4, setopt gives nobeep,
> correct, noglobalrcs, histignoredups, histignorespace, interactive,
> monitor, shinstdin.
> 

mailpath=((${$(echo ~/mail/*.spool(N))//(#m)*/$MATCH?You have new mail in
${MATCH:r:t}}))

should work though. Unfortunately you still need one fork (echo) unless I
miss some obvious way to treat result of nested globbing as array.

-andrey


  parent reply	other threads:[~2002-12-19 11:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-19 11:22 Aidan Kehoe
2002-12-19 11:41 ` Phil Pennock
2002-12-19 11:42 ` Borzenkov Andrey [this message]
2002-12-19 12:03   ` Aidan Kehoe
2002-12-19 12:30     ` Borzenkov Andrey
2002-12-19 12:47   ` Phil Pennock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6134254DE87BD411908B00A0C99B044F03A0B5AC@MOWD019A \
    --to=andrey.borzenkov@siemens.com \
    --cc=kehoea@parhasard.net \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).