Say I've got a bash script:
#!/bin/bash
read -p "Gimme some stuff: " stuff
echo "**${stuff}**"
If the script is invoked with something piping into it, such as:
echo "Here's some stuff" | ./myscript.bash
Then the read command will read from the pipe. Even if I try to clear stdin out before I hit that read command, it will still return immediately.
Is there any way around that? If I don't have any control of the way in which my script is invoked, is there any way to force it to accept input for a read or select from the terminal? If not, are there any sneakier ways to pause the script to get input from a user other than from stdin?