I am not answering your question because I wonder if you are asking the wrong question.
In your first case you need to learn to intervene gracefully.
You script is waiting for end of input, so tell it there is no more input.
In a UNIX shell ctrl-D indicates end of file.
In reply to Re: How do I Determine if my script is being piped to?
by wazat
in thread How do I Determine if my script is being piped to?
by netguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |