Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: var to Array conversion ?
- X-seq: zsh-users 11177
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: var to Array conversion ?
- Date: Sat, 03 Feb 2007 11:33:53 +0100
- In-reply-to: <20070203.095013.74742848.Meino.Cramer@xxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Operating-system: Linux 2.6.19.2-suspend2+ipw2200 i686
- References: <20070203.095013.74742848.Meino.Cramer@xxxxxx>
Meino Christian Cramer <Meino.Cramer@xxxxxx>:
> In a shell script a variable foo is set to 2.0:3.5:0.2
> a=2.0:3.5:0.2
> is there a any short one liner to convert the contents of a into
> the contents which would result from an assignment like
> a=(2.0 3.5 0.2)
See 'man zshbuiltins' (the 'typeset' builtin, '-T' option).
Example:
[snip]
# 3rd arg. to typeset -T is optional (default ':').
typeset -T string array ':'
string="one:two:three:four"
array+=five
print -l $array
[snap]
That is not exactly converting. It is more a way to connect a string
to an array, just as with the $PATH and $path or $FPATH and $fpath
parameters.
Regards, Frank
--
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
-- RFC 1925
Messages sorted by:
Reverse Date,
Date,
Thread,
Author