[Abcde-users] post_encode won't allow user input?

David Murphy glibdud at hotmail.com
Sat Nov 1 01:47:28 GMT 2014


> Date: Fri, 31 Oct 2014 20:15:18 -0400
> From: rogerx.oss at gmail.com
> To: abcde-users at lists.einval.com
> Subject: Re: [Abcde-users] post_encode won't allow user input?
> 
<snip>
>
> I'd really like to see that one big blob main routine which is entirely piped 
> into another blob cleaned up towards the end of abcde; so people can more 
> easily trace code, color syntax will properly work within VI/VIM, and people 
> can add more of their own functions without worrying about that blob.  (ie.  
> That large block of code should look more like "my routine" | "piped into 
> another routine" at the very least instead of piping 100-200 quoted lines into 
> another 100-200 quoted lines. ;-)
>
<snip>

Thanks Roger. You got me looking in the right direction. I hadn't noticed that that's how the main body of the script was run (piped subshells). That answered the "why"; because stdin was being taken from the pipe from the previous subshell. Once I knew the right question to ask, I got help from Superuser:

http://superuser.com/questions/834502/possible-to-get-a-bash-script-to-accept-input-from-terminal-if-its-stdin-has-bee

To summarize, if you want to accept user input in the scripts, redirect stdin from /dev/tty, e.g.:

-----
read -p "Gimme some stuff: " stuff </dev/tty
-----

or

-----
select stuff from 1 2 3
do
    echo "$stuff"
    break
done </dev/tty
-----
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.einval.com/pipermail/abcde-users/attachments/20141031/8c9da36d/attachment.html>


More information about the Abcde-users mailing list