Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Parameter Expansion questions



In ksh, word splitting occurs auto-magically via setting IFS, thus:

   SAVEIFS="$IFS"
   IFS=:
   splitpath=$PATH
   IFS="$SAVEIFS

results in $splitpath having $PATH contents with ':' characters changed
to blanks.

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=$*

and

   splitpath=${=PATH}       // implicit 'set SH_WORD_SPLIT'

and

   splitpath=${buf:s:':':}  // word split s:char:

Can someone let me know what I'm doing wrong in each of these situations?

I did figure out that this works:

   splitpath=${buf:gs/:/ /}

Also,

Also, a pointer to some good examples of parameter expansion would be great.

Thanks.



Messages sorted by: Reverse Date, Date, Thread, Author