Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Parameter Expansion questions
- X-seq: zsh-users 1721
- From: "Zefram" <zefram@xxxxxxxxx>
- To: dfavor@xxxxxxxxxxxxxx (David R. Favor)
- Subject: Re: Parameter Expansion questions
- Date: Mon, 17 Aug 1998 15:45:33 +0100 (BST)
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <35D836E3.F7BEBC77@xxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author