zsh-users
 help / color / mirror / code / Atom feed
From: "Zefram" <zefram@tao.co.uk>
To: dfavor@austin.ibm.com (David R. Favor)
Cc: zsh-users@math.gatech.edu
Subject: Re: Parameter Expansion questions
Date: Mon, 17 Aug 1998 15:45:33 +0100 (BST)	[thread overview]
Message-ID: <199808171445.PAA24008@diamond.tao.co.uk> (raw)
In-Reply-To: <35D836E3.F7BEBC77@austin.ibm.com> from "David R. Favor" at Aug 17, 98 08:57:55 am

David R. Favor wrote:
>In zsh, I'm having a challenge deciphering the manual about parameter
>expansion options. I've tried the following, without success. All fragments
>set $IFS=: before expansion:
>
>   export SH_WORD_SPLIT     // explicit 'set SH_WORD_SPLIT'
>   splitpath=$*

zsh doesn't perform field splitting on the RHS of scalar variable
assignments.  Try "echo $*" under equivalent circumstances.

>I did figure out that this works:
>
>   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.

-zefram


  reply	other threads:[~1998-08-17 15:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-17 13:57 David R. Favor
1998-08-17 14:45 ` Zefram [this message]
1998-08-17 15:10   ` Bruce Stephens
1998-08-17 17:09   ` Bart Schaefer

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=199808171445.PAA24008@diamond.tao.co.uk \
    --to=zefram@tao.co.uk \
    --cc=dfavor@austin.ibm.com \
    --cc=zsh-users@math.gatech.edu \
    /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).