fix copy-packages in zsh

fixes #299, finally, using the local var syntax
Merge branch 'master' into #299
Merge pull request #335 from naartjie/#299

fix copy-packages in zsh