From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1890 invoked from network); 19 Oct 2004 13:52:17 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 Oct 2004 13:52:17 -0000 Received: (qmail 36789 invoked from network); 19 Oct 2004 13:52:11 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Oct 2004 13:52:11 -0000 Received: (qmail 29398 invoked by alias); 19 Oct 2004 13:51:22 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8076 Received: (qmail 29384 invoked from network); 19 Oct 2004 13:51:21 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 19 Oct 2004 13:51:21 -0000 Received: (qmail 35566 invoked from network); 19 Oct 2004 13:51:21 -0000 Received: from mxfep01.bredband.com (195.54.107.70) by a.mx.sunsite.dk with SMTP; 19 Oct 2004 13:51:20 -0000 Received: from puritan.pcp.ath.cx ([213.112.43.197] [213.112.43.197]) by mxfep01.bredband.com with ESMTP id <20041019135120.MYCU18265.mxfep01.bredband.com@puritan.pcp.ath.cx> for ; Tue, 19 Oct 2004 15:51:20 +0200 Received: by puritan.pcp.ath.cx (Postfix, from userid 1000) id 2D1E6AE041; Tue, 19 Oct 2004 15:51:22 +0200 (CEST) Date: Tue, 19 Oct 2004 15:51:22 +0200 From: Nikolai Weibull To: zsh-users@sunsite.dk Subject: Re: Redirection and Variables Message-ID: <20041019135121.GA12143@puritan.pcp.ath.cx> References: <20041019120220.GA9258@puritan.pcp.ath.cx> <200410191304.i9JD46qt025040@news01.csr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200410191304.i9JD46qt025040@news01.csr.com> User-Agent: Mutt/1.5.6i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: * X-Spam-Status: No, hits=1.5 required=6.0 tests=RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 1.5 * Peter Stephenson [Oct 19, 2004 15:10]: > > lookup () { > > echo "${(P)$(echo ${1}_programs\[xw\])}" > > } > Using eval would be nicer than the $(...), but actually there's a hack > to avoid even that: > lookup() { > echo ${(P)${:-$1_programs[xw]}} > } Ah, sweet. Using eval always feels like a hack either way. Maybe I should stop thinking that. > The empty nested substitution always returns the string after the :-, > which undergoes expansion, so the (P) flag can operate on that. > > If I have the following in a script that reads input from stdin: > > sed -n "s/$REGEX/\1\n/gp" <&0 | sed "/$REGEX/!d" > $TMP > > if [[ ! -s $TMP ]]; then > > rm -f $TMP > > exit 1 > > fi > > ${EDITOR:-vi} $TMP > > my $EDITOR (vim) will complain that > > "Vim: Warning: Input is not from a terminal". Is there a simple way to > > get around this? > Are you saying the early part is important, i.e. if you just run vi in > the script without the earlier bit it works? That sounds unlikely, > although I haven't investigated in detail. If that's not the case, you > probably need to do some direction to force vi to use /dev/tty. Well, the script is run like url-extract I'm not sure why you have "<&0", that simply redirects standard input > from standard input. Oops, how very silly of me, nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}