I have a script that is run like this:curl https://example.com/install.sh | zsh - The script needs to read from use input:read human_name?Your human name ?</dev/ttyThe problem is the user sees the input and can enter their response but the response is not stored in human_name.Example:cat <<EOM | zsh -read human_name?Your human name ?</dev/tty   if [ -z $human_name ] ; then echo tears ; else echo HI $human_name; fiEOMResults in:Your human name ?PattearsAny guidance?
Reading from tty in piped shell
command line;zsh
You can always read from the terminal by redirecting from /dev/tty, as long as the program is not a background job. If it's a background job, it'll be paused by a SIGTTIN until it gets switched to the foreground.The problem with your script is not reading from the terminal, but what you do with what you've read. You used a here document with interpolation, so $human_name is interpolated while constructing the here document, and it's empty at the time. You need to either use a here document without interpolation or quote the dollar signs so that the shell you run with zsh - sees and parses them.cat <<'EOM' | zsh -read human_name?Your human name ?</dev/tty   if [ -z $human_name ] ; then echo tears ; else echo HI $human_name; fiEOM