Hack 37. Installing the less Pager on Your TiVo

   

Hack 37 Installing the less Pager on Your TiVo

figs/moderate.gif figs/hack37.gif

Do more with less , the best way to page through and find things within a text file .

There's an old Unix saying: "less is more." It refers to two paging programs or commands, more and less , used to scroll through a text file a line or page at a time. While more is usually more than enough, less does all that more can and moremost notably, the ability to move and search not just forward, but also backward through a file. Indeed, less is more than more (Unix geeks just love this stuff!).

The Unix utilities package [Hack #34] doesn't have any prepackaged pagers , so I recommend you install less . Grab yourself a copy of the precompiled version for TiVo from http://prdownloads. sourceforge .net/tivoutils/less-378-s1.tar.gz?download. Don't expand the archive; just transfer it [Hack #36] as is to the /var/hack directory on your TiVo and run the following commands to expand the archive, put less into place, and remove the unneeded archive:

 bash-2.02#  cd /var/hack  bash-2.02#  gzip -d less-378-s1.tar.gz  bash-2.02#  cd /  bash-2.02#  cpio -I -H tar --make-directories < /var/hack/less-378-s1.tar  bash-2.02#  rm /var/hack/less-378-s1.tar  

This will expand less into /var/hack/bin , where we have been putting the rest of the hacks, commands, and applications. At the same time, it is going to place a few needed libraries into /var/hack/lib . We need to tell TiVo where to find these library files by altering the LD_LIBRARY_PATH environment variable; this is done in much the same way we edited the PATH , by modifying TiVo's .profile file:

 bash-2.02#  remount -o remount,rw /  bash-2.02#  echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/hack/lib" >> /.profile  bash-2.02#  remount -o remount,ro /  

This will help you out the next time you reboot your TiVo, but if you want it to take effect now, simply reexport LD_LIBRARY_PATH on the command line, like so:

 bash-2.02#  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/hack/bin  

Give it a whirl by taking a peek at the rc.sysinit file:

 bash-2.02#  less /etc/rc.d/rc.sysinit  

To scroll forward a page at a time, hit the spacebar; hit the B key to scroll backward. You can also go forward and backward a line at a time using the down and up arrows, respectively.


   
Top


Tivo Hacks. 100 Industrial-strength Tips Tools 2003
Tivo Hacks. 100 Industrial-strength Tips Tools 2003
ISBN: 1597490318
EAN: N/A
Year: 2004
Pages: 164

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net