lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Dec 6, 2013 at 12:49 PM, Bernd Eggink <monoped@sudrala.de> wrote:
> I don't think this is what he OP wants; I think he wants to read from the
> pipe (stdin) _and_ from the terminal. This can be done in Linux by something
> like
>
>         history -n | tail -n 10 | my_script 3<&1


well, if using bash, you could also do:

       myscript <(history -n | tail -n 10)

the script would get a filename parameter, which refers to a pipe
connected to the output of the `tail` process.  all without touching
stdin.

in the script io.stdin still gets the terminal, and doing
io.open(arg[1], 'r') gets the 'piped' output.


-- 
Javier