in reply to Re: Refresh display in Perl
in thread Refresh display in Perl

Instead of launching the 'clear' command everytime you can also store the clear sequence in a variable then just print it:
perl -e '$clear=`clear`; system("who"),sleep 10,print $clear while 1'

Replies are listed 'Best First'.
Re: Re: Re: Refresh display in Perl
by sauoq (Abbot) on Jul 30, 2003 at 19:33 UTC

    Uh... Yes... But that makes your one-liner longer and saving the overhead of calling clear really isn't worth it.

    -sauoq
    "My two cents aren't worth a dime.";
    

      Or... skip the system call altogether and use some ascii escape codes :) Assuming you're using a terminal that supports it:

      perl -le 'print "\e[2J\e[H", `who` and sleep 2 while 1'


      If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

        Or... bring back clear to make it slightly more portable and save some keystrokes. :-)

        perl -e 'print `clear`,`who` and sleep 2 while 1'

        -sauoq
        "My two cents aren't worth a dime.";