install.sh: Handle redirects properly

Also strips some bashisms

Fixes #415