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

Re: Read file with escaped newlines into array



On 19 November 2015 at 20:17, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Nov 19,  6:34pm, Sebastian Gniazdowski wrote:
> }
> } fc -W stores history to a given file. It escapes newlines with \. How
> } to read such file into array and have "\^M" lines put back together
> } into single array entries?
>
> The best way is probably to use the history mechanism to read it:
>
>     () { fc -ap -R the_given_file ; the_desired_array=( ${history} ) }

This works, but I wonder, how it's possible that zsh/parameter
variables such as $historywords are made local?

Best regards,
Sebastian Gniazdowski



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