[Linux] manually write the man program for reading manpage

Source: Internet
Author: User

My testing machine has many problems. Previously, safe cannot be installed, and staf cannot be installed. Man cannot be used now ......

It turns out to be

Man man <br/> fgets: no such file or directory <br/> Error reading man page/usr/share/man/en/Man1/man.1.gz <br/> no manual entry for man <br/> 

Now yes

# Man man <br/> error executing formatting or display command. <br/> System Command (CD/home/wulongfei/tool/man-pages-3.28 & (echo ". ll 11.8i "; echo ". PL 1100i ";/bin/cat'/home/wulongfei/tool/man-pages-3.28/Man1/man.1 '; echo ". /// ""; echo ". PL/N (nlu + 10 ") |/usr/bin/gtbl | nroff -- legacy ISO-8859-1-man-rll = 129n-rlt = 129n 2>/dev/null |/usr/bin/less-IRS) exited with status 32512. <br/> no manual entry for man

After Baidu Google's failure, he was excited and planned to write a man program to read manpage. First download the latest man-pages-3.32.tar.bz2. It is found that there are only three manpages in Man1, so it is merged with the original manpage in the local area, and there are three folders in MAN [0-9. The man. Sh code is as follows:

#! /Bin/bash <br/> Cd/home/wulongfei/tool/man-pages-3.28 <br/> If [$ #-LT 1]; then <br/> echo "what do you want to man? :) "; <Br/> exit <br/> fi <br/> If [$ #-GT 2]; then <br/> echo "Please man one thing at a time :("; <br/> exit <br/> fi <br/> If [$ #-EQ 1]; then <br/> Index = 1; <br/> tofind = $1; <br/> fi <br/> If [$ #-EQ 2]; then <br/> Index = $1; <br/> tofind = $2; <br/> fi <br/> echo "*************************" <br/> echo $ index, $ tofind; <br/> echo "***********************" <br/> while [$ index- le 9] <br/> DO <br/> If [-F man $ index/$ tofind. $ Index]; then <br/> # echo ". ll 11.8i "; <br/> # echo ". PL 1100i "; <br/> # Cat" man $ index/$ tofind. $ Index "; <br/> # echo ". /// ""; <br/> # echo ". PL/N (nlu + 10 "|/usr/bin/gtbl | nroff -- legacy ISO-8859-1-man-rll = 129n-rlt = 129n 2>/dev/null |/usr/ bin/less-IRS; <br/> (echo ". ll 11.8i "; echo ". PL 1100i ";/bin/cat"/home/wulongfei/tool/man-pages-3.28/man $ index/$ tofind. $ Index "; echo ". /// ""; echo ". PL/N (nlu + 10 ") |/usr/bin/gtbl | nroff -- legacy ISO-8859-1-man-rll = 129n-rlt = 129n 2>/dev/null |/usr/bin/less-IRS <br/> exit <br/> fi <br/> let Index = index + 1; <br/> echo "***********************" <br/> echo $ index; <br/> echo "***********************" <br/> done <br/> echo "no manual for $ tofind "; 

I think you can also see that the key code is a copy of the error message ...... I don't know either ......

For input, the original input habits are not changed (that is, input man instead of man. SH. SH is changed to man, and copied to the beginning of path (which can be found first than the original man in the system). The problem persists. Later I thought of using alias to solve the problem. That is

Vim ~ /. Bash_profile <br/> # Add the following sentence <br/> alias man = ~ /Man. Sh # The path where you store man. Sh <br/> # And <br/> source ~ /. Bash_profile <br/> 

Then you can use man as before!

 

PS: the cause of the problem is still unclear. Google seems to say that the problem may occur when upgrading the kernel.Let me know ~

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.