Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: piping question



On Oct 2,  4:13pm, Helmut Jarausch wrote:
}
} Now I'd like to write a shell script 'xmost' which
} should do the same as 'most' but with its output sent to a newly
} generated xterm.

xterm is going to reset the stdin/stdout of whatever command it runs
to be the terminal input/output, so you can't pipe directly into a
command that's running under xterm.

So the trick is that you have to capture the output in a file and
pass the file's name to the command running in the xterm.  Zsh will
automatically create an appropriate file name for you by using the
process substitution syntax.

So try something like this:

    xmost() {
	() { xterm -g 180x30+0+0  -hold -e "most < $1" } <(cat)
    }

If you don't have a recent zsh with anonymous functions, you'll need
a helper function of some kind to capture the file name created by
<(cat) and pass it through to xterm.



Messages sorted by: Reverse Date, Date, Thread, Author