Improved "pager" for man pages

Joel Hammer Joel
Mon May 17 11:50:58 PDT 2004


Opps. Already found a bug.
I forgot that a 0 byte file is generated with man -t $1 > junk$$ if the man
page doesn't exist, so -s has to be used.

Like so:

#!/bin/bash
man -t $1 > /tmp/junk$$
[ -s /tmp/junk$$ ] ||  {
       rm /tmp/junk$$
        exit
           }
ps2pdf /tmp/junk$$ /tmp/$1
rm /tmp/junk$$
ReadMan $1 &

Joel



On Thu, Aug 14, 2003 at 09:23:31AM -0400, Joel Hammer wrote:
> Well, I couldn't leave well enuf alone.
> I got annoyed by my new and improved man pager, since the calling shell
> can't be used until the acroread session is closed.
> 
> So, here is the better mouse trap. It needs two scripts, not one.
> First script is called Man
> 
> man -t $1 > /tmp/junk$$
> [ -a /tmp/junk$$ ] ||  exit
> ps2pdf /tmp/junk$$ /tmp/$1
> rm /tmp/junk$$
> ReadMan $1 &
> 
> The second script is called ReadMan
> 
> acroread /tmp/$1
> rm /tmp/$1
> 
> To use it, just type:
> Man ping [or whatever] and voila.
> 
> A nice part is that you can use the shell again, and if you want, open
> another man page with Man rm [or whatever].  The second man page is opened
> up in the same instance of acroread, making things very convenient.
> 
> Now, this would be nicer if someone could show me how to make this into
> just one script. A here document might be the way to go, but I have
> never figured those out.
> 
> Joel
> 
> On Mon, Jul 21, 2003 at 09:38:09PM -0400, Joel Hammer wrote:
> > Don't know why, but with lindows 4 I have lost my usual vi like button
> > functionality with the man pager. Oh well.
> > 
> > So, here is a "pager" which is greatly improved. This allows searching
> > as well, which wouldn't work with just the postscript output. Of course,
> > this only runs in a GUI, but, that's where I spend most of my time these
> > days, anyway.
> > 
> > #!/bin/sh
> > man -t $1 > /tmp/junk$$
> > ps2pdf /tmp/junk$$ /tmp/junkpdf$$
> > acroread /tmp/junkpdf$$
> > rm /tmp/junk$$
> > rm /tmp/junkpdf$$
> > 
> > Joel
> > 
> > _______________________________________________
> > Linux-users mailing list
> > Linux-users at linux-sxs.org
> > Unsubscribe/Suspend/Etc -> http://www.linux-sxs.org/mailman/listinfo/linux-users
> _______________________________________________
> Linux-users mailing list
> Linux-users at linux-sxs.org
> Unsubscribe/Suspend/Etc -> http://www.linux-sxs.org/mailman/listinfo/linux-users


More information about the Linux-users mailing list