The problem is the `read` which expects to read from stdin, and that fails when you're piping (it fails to read what you are expecting to read and instead reads the text of the actual script, which is being piped in on standard input, causing the syntax error by effectively deleting the line after the `read` statement from the script). So use command substitution instead to execute the contents inline:
bash -c "$(curl
Or
bash -c "$(wget -O-