shell script implementation of man

Matthew Hiles matthew.hiles at gmail.com
Sun Nov 23 14:30:26 UTC 2008


walter harms wrote:
> just to provide an alternative way:
>
>  case "$pagefile" in
>  *.bz2)
>          CAT="bzcat" ;;
>  *.gz)
>          CAT="zcat" ;;
>  *)
>          CAT="cat"  ;;
>  esac
>
> "$CAT" "$pagefile" | "$PAGER" "$pagefile"
>
> this can easily be expanded to dot-whatever-you-like
>
>
> re,
>  wh
>
>

Currently what I have in my script that I've been applying suggestions 
to, I have:


case "$pagefile" in  
*.bz2)
        exec bzcat "$pagefile" | "$PAGER" ;;
*.gz)
        exec zcat "$pagefile" | "$PAGER" ;;
*)
        exec "$PAGER" "$pagefile" ;;
esac


Though I don't understand this line:
 > "$CAT" "$pagefile" | "$PAGER" "$pagefile"

Shouldn't that be?:

"$CAT" "$pagefile" | "$PAGER"


---

The other thing I wanted to mention was the possibility of extending 
this little man script, or creating an alternate, so that it could look 
up man pages from a single file to prevent a whole 1kb, 2kb, 4kb or w/e 
sized inode from being used to hold a single 200 byte compressed ascii 
man page. Does this sound like a good idea?

~Matthew Hiles



More information about the busybox mailing list