Dienstprogramme zum Suchen und Öffnen von Linux / usr / share / docs?

1287
Xiè Jìléi

Zum Beispiel kann ich die Handbuchseiten von bash lesen durch:

$ man bash 

oder

$ info bash 

Es gibt aber auch / usr / share / doc / bash, das andere verwandte Dokumente enthält. Wenn ich in die Dokumente der EZB (emacs code browser) schaue, gibt es in / usr / share / doc / ecb / html ein Programm, das die HTML-Datei für mich findet? Zum Beispiel kann ich tippen

$ htmldocs ecb 

anstatt

$ cd /usr/share/doc/ecb/html $ firefox ... 
4

2 Antworten auf die Frage

3
Ignacio Vazquez-Abrams

Jede Anwendung ist dafür verantwortlich, ein eigenes Werkzeug zum Lesen der Dokumente in zur Verfügung zu stellen /usr/share/doc. Es gibt keinen universellen Mechanismus, um damit umzugehen.

0
dmonopoly

I'm quite late, but I thought I'd add my input: if your goal is to have some command like

htmldocs some/path/or/file 

you can write your own script inside a personal scripts folder, e.g., /usr/utils, add that folder to your PATH (in your .bashrc file - see What is the .bashrc file?), and then just execute your personal command.

This way, I've been able to define my own scripts that do whatever I want, e.g.,

sprocs 

my own command which runs

ps -ef | grep Server 

so I can easily see what server processes are running on my machine.

An example of a script's contents would be like

#!/bin/bash ps -ef | grep Server echo "my message to output in terminal" # etc... 

and this file, call it 'sprocs' (no extension) or something, would be in the folder you made / any folder that is on your PATH, so you can just type 'sprocs' in your terminal, and it just works.

https://www.linux.com/learn/tutorials/284789-writing-a-simple-bash-script- describes how to get started with your own script. The #!/bin/bash is the standard first line that just lets your terminal access the commands. If you used python, it would be #!/usr/bin/python (assuming that's where python is installed).

Your case might have different commands like

#!/bin/bash cd /usr/share/doc/ecb/html firefox somefile.html # etc... 

If you wanted flexibility, you probably want to pass parameters, so you could check out http://floppix.ccai.com/scripts1.html for an example at the bottom.

(Even if you don't do this, it's definitely useful for running personal scripts from terminal that do exactly what you want.)