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

Re: reading a file into an array. mapfile? (f)?





On Thu, Sep 18, 2008 at 12:44 AM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:


It's much simpler than you seem to believe:

lines=( ${(f)mapfile[/path/to/file]} )

Doesn't seem to work if the file (/path/to/file) has 0-length lines. These don't get stored in the array (lines).

Might be more difficult than you seem to believe :-)



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