From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22722 invoked from network); 17 Aug 1998 15:28:53 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 17 Aug 1998 15:28:53 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id LAA22135; Mon, 17 Aug 1998 11:15:36 -0400 (EDT) Resent-Date: Mon, 17 Aug 1998 11:15:27 -0400 (EDT) Sender: dfavor@austin.ibm.com Message-Id: <35D849A7.4EB5F516@austin.ibm.com> Date: Mon, 17 Aug 1998 10:17:59 -0500 From: "David R. Favor" X-Mailer: Mozilla 4.05 [en] (X11; I; AIX 4.3) Mime-Version: 1.0 To: Zsh List Subject: [Fwd: Parameter Expansion questions] Content-Type: multipart/mixed; boundary="------------4F58684F5587E968AA91A68F" Resent-Message-ID: <"nxlBy2.0.DP5.Fa4sr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1723 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu This is a multi-part message in MIME format. --------------4F58684F5587E968AA91A68F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit --------------4F58684F5587E968AA91A68F Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <35D8496A.B936DCDF@austin.ibm.com> Date: Mon, 17 Aug 1998 10:16:58 -0500 From: "David R. Favor" X-Mailer: Mozilla 4.05 [en] (X11; I; AIX 4.3) MIME-Version: 1.0 To: Zefram Subject: Re: Parameter Expansion questions References: <199808171445.PAA24008@diamond.tao.co.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > > splitpath=${buf:gs/:/ /} > > That's doing a substitution, rather than field splitting. Since the > effect you're asking for is actually a substitution, rather than field > splitting (since you're just joining up the fields again anyway), this > is logically the correct thing to do. > > OTOH, I suspect that you *really* want to be using an array parameter. > $path is an array version of $PATH, so you don't even need to do the > splitting manually in that case. Here's a larger fragment of the function I'm using, that is a wrapper around vi to check several directories for a file to edit. What is the recommended way to accomplish this in zsh, hopefully while retaining ksh compatibility also? I would like to get rid of the $shell_type nonsense and the ${=editpath} syntax in the loop. Thanks. _______ # paths to search editpath=${EDITPATH:-"$PATH:$CDPATH"} IFS=: if [ $shell_type = 'zsh' ] ; then <<< $shell_type editpath=${editpath:gs/:/ /} else editpath=$editpath fi IFS="$BACKUP_IFS" for name in $* ; do for dir in ${=editpath} ; do <<< ${=editpath} # find/edit the file done done --------------4F58684F5587E968AA91A68F--