pipe data to less of (xterm -e less) ?

pipe data to less of (xterm -e less) ?

Post by Nan-shan Ch » Sun, 23 Mar 1997 04:00:00


Please help me to solve this. The command:

        cat data | xterm -e less

does not work. Note that the less has to read
from stdin in my case (I'm in a GUI and am reading
output from paste).

Any trick available?

Thanks for your help!

Nan-shan Chen, Pohlweg 47-49, 33098, FB14, Uni-Paderborn


pipe data to less of (xterm -e less) ?

Post by Icarus Spar » Mon, 24 Mar 1997 04:00:00


>Please help me to solve this. The command:

>    cat data | xterm -e less

>does not work. Note that the less has to read
>from stdin in my case (I'm in a GUI and am reading
>output from paste).

>Any trick available?

Well, the most obvious idea is to use 'xless'. If there is a proper
X program then running a terminal based program in a window must be
described as a bodge!

However let us assume that 'less' is just an example, and you want
a general solution.

The reason that you are having problems is that 'xterm' closes file
descriptors 0, 1, and 2, and reopens them connected to a pseudo tty. So
all you have to do is move the file descriptors around. This requires a
'sh' type shell, as 'csh' is not powerful enough to do it.

cat data | (
        exec 6<&0 # Save standard input on FD 5
        xterm -e sh -c '
                exec 0<&6 # Get our original standard input back, not the pty
                less '



1. Even less from LESS


I've got a Slackware Linux box running damn near perfectly.  One problem
that has been annoying me, though is with less.  It seems that, only
when I'm in an xterm (ie, term=xterm), less clears the screen when it's
finished.  If you type less <filename> at a prompt, the file (if it's
big enough) will fill the entire screen.  Everything behaves normally.
At the end of the file, though, all traces of the contents of the file
are cleared and you see the original screen from which you started less
reappear, with a new command prompt below the first.

I've noticed that if I set term=vt100, the problem goes away and when I
reach the end of a file, I get a new prompt on the line below the last
line of the file - just as cat would do and just what you normally

I use LESS=-E -m -n, but I don't think that has to do with it.  A
friend's system does not have this behavior in xterms, though I can't
figure out why.

Paul McKee

2. Weird problem. Need HELP!!

3. Less and less

4. what do you think about extending buslogic block statistics to more devices?

5. less -X with less effect

6. Question : EPAS

7. What handles the pipe symbol in pseudofile names like "|less"?

8. Linux 2.1.9 & over + PPP ...

9. Problem with piping to LESS

10. xterm doesn't restore screen after vi or less

11. Xterm and less

12. 'less','more' turn xterm inverse video

13. less / xterm