I'm not looking for work-arounds or solutions for the issue. I'm fine with it not working like that in `bash`. I just don't understand *why* it doesn't work.

I'm looking for an in-depth answer why the following script doesn't work. All previous internet search results, including posts from unix.stackexchange.com, couldn't really clear this up completely. It has something to do with `read` reading from `stdin` which doesn't work because `stdin` is already "taken" (?) by `cat` feeding `bash` via the pipe?

Example bash script `test.sh`:

    echo "Please say name:"
    read NAME
    echo "Hello $NAME"

Method 1 calling the script with `bash test.sh`:

    $ bash test.sh
    Please say name:
    XYZ
    Hello XYZ
    $

Method 2 running the script via piping to `bash`:

    $ cat test.sh | bash
    Please say name:
    $

So the script immediately returns to the prompt, without waiting for input or even printing the second line.