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

Anonymous array indexing



Hello,

Is there a compact version of the following:

    fred=(one two three)
    export FRED=$fred[2]
    unset fred

I am looking for something like

    export FRED=(one two three)[2]

so that I can avoid having to use the temporary variable fred.
The above doesn't work.  Is there something equivalently short I
can use?  I'm running zsh 3.1.9.

Thanks,

Steve



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