Fix compatibility with Zsh arrays

* Zsh arrays starts at 1
* Zsh arrays have to be declared before being assigned
More quotes to improve Zsh compatibility

This commit changes most of the occurrences of
  x=$(cmd)
into
  x="$(cmd)"

When cmd is returning multiple words or lines Zsh interprets
them as an array. Putting those quotes ensures we get a single
string with spaces inside.
Merge pull request #192 from np/zsharrays

Fix compatibility with Zsh arrays
Merge pull request #193 from np/zshcompat

Zshcompat: More quotes to improve Zsh compatibility