Skip to content

Instantly share code, notes, and snippets.

@nicerobot
Created March 24, 2013 21:12
Show Gist options
  • Save nicerobot/5233543 to your computer and use it in GitHub Desktop.
Save nicerobot/5233543 to your computer and use it in GitHub Desktop.
How to incorporate usage into sh
#!/bin/bash
grep "^## " "$0" | cut -c 4- | groff -Tascii -man | more
## .TH USAGE 1 "March 24 2013" "Version 1.0" "USER COMMANDS"
## .\" strings
## .ds ex \fIexpr\fR
## .SH NAME
## usage \- example of incorporating usage
## .SH SYNOPSIS
## .B usage
## .PP
## .SH DESCRIPTION
## .B usage
## is an example of sh usage as man format.
## .PP
## .SH OPTIONS
## .B usage
## .PP
## .SH BUGS
## .B usage
## .PP
## .SH AUTHOR
## nicerobot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment