I have a script with some 'USAGE' function. It echoes the params/args, etc. I know I can create a custom MAN page file, as of ex:
.TH man 8 "09 May 2021" "1.0" "myscript man page"
.SH NAME
myscript \- do some stuff
.SH SYNOPSIS
myscript [STUFF]
.SH DESCRIPTION
myscript is very useful and blah blah blah lorem ipsum lorem ipsum lazy dog jump over the brown fox.
and read it just fine, so it will be shown as a man page with
man ./man-file
Anyways, I want to embed this into the script; then show it as MAN formatted from there. I dont want to have an external file for it.
Simple part, is simple. Create a var within the script having above contents as MAN syntax. Now, how can I show it as MAN formatted?
Here are my tryings, nothing yielded any good result.
echo $man_text_var | man
man < <(echo $man_text_var)
echo $man_text_var | man /dev/stdin
man /dev/stdin <<EOF
$man_text_var
EOF
is there a way to accomplish it? and yes, I did see the post Display man page from stdin - but it does not solve my problem. not using RST or POD.