Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added two tiny, but useful utility functions.
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## outputs the number of (regular) files contained within a given directory | ||
# if invoked without an argument, defaults to the current directory | ||
function count-files { | ||
dir=$1 || $CWD | ||
find $dir -type f |wc -l | ||
} | ||
|
||
## converts a man page to a PDF file | ||
# Usage: man2pdf <COMMAND> [OUTPUT_DIR] | ||
# where COMMAND is the shell command/program whose manual page is to be | ||
# converted and OUTPUT_DIR is the filesystem directory where to place the | ||
# generated PDF file (defaults to the current directory). | ||
|
||
function man2pdf { | ||
command=$1 | ||
out_dir=$2 || $PWD | ||
out_fname=${command}_manpage.pdf | ||
man -Tps $command | ps2pdf - ${out_dir}/${out_fname} | ||
} |