[colug-432] bash pipe + read?

Jeff Frontz jeff.frontz at gmail.com
Mon Nov 16 11:25:02 EST 2015

On Mon, Nov 16, 2015 at 10:38 AM, Rick Hornsby <richardjhornsby at gmail.com>

> I think I understand the problem - what's happening is that because
> there's an input pipe to bash, read takes the next line of the script as
> its input instead of taking it from the user - they're both on stdin.

If I understand your question/scenario, you probably want to redirect your
read from /dev/tty (a la "$ read < /dev/tty someVariable").  You can also
use the tty command to figure out if there is actually a tty associated
with the shell (e.g., to provide some useful default behavior if the script
is run from, say, a crontab or at job).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20151116/9a70d98c/attachment.html 

More information about the colug-432 mailing list