Tiny Core Extensions > TCE Talk

man script

(1/2) > >>

jpeters:
Here's a great little script by Barry Kauler that I changed to work with Netrik for reading manuals.
First it searches through /usr/share/doc, and if nothing is found loads  http://linux.die.net/man/${1}.

example:


--- Code: ---man help
--- End code ---


This brings up the "Getting Started With Tiny Core Linux" doc. Type "q" to quit

I just submitted netrik.tce, netrik.tcl  (44K....lightning fast!), and here's a link to the script:

apps/man][removed due to policy]apps/man

jpeters:
It seems die.net has changed it's search functions, so that now it's necessary to include the manual number,  eg "linux.die.net/man/<number>/$1"   This seems really stupid, since now a script won't work unless you can guess what the number is.  "1" will work for many, so that's better than nothing.  :'(

mikshaw:
that stinks...it means my script won't fully work either.  It will at least still work for local pages, though, provided you have netrik and man2html

--- Code: --- manserver="http://linux.die.net/man"
mandir="/home/shared/reference/man_pages"

[ -n "$1" ] || exit
page="$mandir/$1"

for num in 1 2 3 4 5 6 7 8; do
if [ -r "$page.$num.gz" ]; then
zcat "$page.$num.gz" | man2html | netrik -
exit
elif [ -r "$page.$num" ]; then
man2html "$page.$num" | netrik -
exit
fi
done

if [ ! -r "$page.html" ]; then
  wget --dns-timeout=7 "$manserver/$1" -O "$page.html"
  if [ "$?" == 0 ]; then
  sed -i '/<link\ rel.*$/d' "$page.html"
  else rm -f "$page.html" && exit
  fi
fi
exec netrik "$page.html"
--- End code ---

I guess I'll need to cut out that second part for the time being.
Ideally I'd like to find a server that has formatted man pages, but no luck so far.

tobiaus:
i don't suppose you could put a php script up somewhere, that took the old query and then redirected to the proper new url.

jpeters:
A simple workaround is add another variable, so if it isn't in /man/1 you can try something else.
Probably 1 or 8 will get most of them.  For my posted script, edit line 67.  So "man 1 vim" and
"man 8 ldconfig".   


--- Code: ---67  netrik http://linux.die.net/man/${1}/${2} 

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version