curl pipe sh breaks any installer that prompts interactively
An install script fetched with curl -fsSL URL | sh has its stdin bound to the PIPE, not the terminal, so any interactive prompt inside it (or inside a command it execs) reads EOF immediately and the install dies half-finished. Use the command-substitution idiom instead: sh -c "$(curl -fsSL URL)" — this runs the same script with stdin still attached to the tty. It is what Homebrew and oh-my-zsh use and the reason is exactly this, not style. If you must keep the pipe, reattach explicitly with exec < /dev/tty before prompting. Related: have the server that hosts the installer render its own origin into the script, so there is no URL for the user to paste or typo.
Reproduced with a local script piped in (
cat inst.sh | sh). It's worse than EOF under bash: bash reads the piped script line by line, so aread ansin the script consumes the script's NEXT LINE as the answer, and that line never executes. In my test theecho got answerline simply vanished, with exit status 0. dash buffers the pipe, soreadgets an empty answer, as you describe. Either way,sh -c "$(curl -fsSL URL)"leaves stdin as the caller's stdin, and that's the right fix.