Chinaunix首页 | 论坛 | 博客
  • 博客访问: 389105
  • 博文数量: 61
  • 博客积分: 2525
  • 博客等级: 少校
  • 技术积分: 455
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-24 13:22
文章分类

全部博文(61)

文章存档

2008年(4)

2007年(57)

我的朋友

分类: LINUX

2008-03-25 11:26:46

因为自己的需要,特写了个脚本从fc6中提取man文件做成html的chm格式电子书,脚本如下,最后的成型的版本可以在这里下载
 

#!/bin/bash

#This is a manual transform script

#it will transform all manuals to htmls


MAN2HTML=/usr/bin/man2html
MANPATH=/home/tt/man/man
GZ=/bin/gzip
TargetHtmlPath=/home/tt/pp

NUM=9
function createhtml()
{
    for (( i=1; i<=NUM; i++ ));
    do
        dir="${MANPATH}${i}"    ##get target path

        if [ -d $dir ]
        then
        (
        cd $dir
        ${GZ} -dvf *.gz && ${MAN2HTML} ".*${i}"
        for file in *
        do
            if [ -f $file ]
            then
            ${MAN2HTML} $file >"${file}.html"
            fi
        done
        )
        fi

        
        dir2="${MANPATH}${i}p"    ##get target path

        if [ -d $dir2 ]
        then
        echo $dir2
        (
        cd $dir2 && ${GZ} -dvf *.gz && ${MAN2HTML} ".*${i}"
        for file in *
        do
            if [ -f $file ]
            then
            ${MAN2HTML} $file >"${file}.html"
            fi
        done
        )
        fi    
    done
}


function copyhtml()
{
    for (( i=1; i<=NUM; i++ ));
    do
        dir="${MANPATH}${i}"    ##get target path

        if [ -d $dir ]
        then
        (
        cd $dir
        pwd
        #cp *.html ${TargetHtmlPath} -v

        for file in *.html
        do
            cp ${file} ${TargetHtmlPath} -v
        done
        )
        fi
            
        dir2="${MANPATH}${i}p"    ##get target path

        if [ -d dir2 ];
        then
        (
        cd $dir2
        pwd
        #cp *.html ${TargetHtmlPath} -v

        for file in *.html
        do
            cp ${file} ${TargetHtmlPath} -v
        done
        )
        fi
    done
}

#createhtml

copyhtml

阅读(5455) | 评论(4) | 转发(4) |
给主人留下些什么吧!~~

chinaunix网友2009-01-15 05:35:53

兄弟谢了~

est2008-10-23 00:31:29

正确地址 http://202.117.118.26/files/LinuxManual_ver1.1.CHM

chinaunix网友2008-10-15 18:53:34

下载不了,请发至 libra_jlu@163.com

chinaunix网友2008-10-14 16:45:15

非常强大,兄弟支持你。 能否将你已经做好的chm发给我一份啊,我从上面的地址无法下载。 我的邮箱是 kuqideyazi@yahoo.com.cn 最近我想翻译linux中的man的联机帮助文档。 希望你支持,急需从linux中提取man的所有命令