Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A script to open man pages in BBEdit UNIX
I use BBEdit to read man pages with the following script -- I'm sure you could use Text Wrangler or any other text editor, with some modifications. The script checks a predefined storage area for an existing plain text version of the man page, and opens it if one exists.

If no plain text version is found, then the script creates the file, changes its creator type (assuming the Developer Tools are installed) to R*ch (BBEdit) and opens the file using BBedit's command line tools.
#!/bin/bash

if [ -f /usr/bin/bbedit ] ; then

  MANTEXT=/Users/username/man

  if [ -f $MANTEXT/$1.txt ] ; then
    bbedit $MANTEXT/$1.txt
  else
    man $1 | col -b > $MANTEXT/$1.txt
    if [ -f /Developer/Tools/SetFile ] ; then
      /Developer/Tools/SetFile -c R*ch $MANTEXT/$1.txt
    fi
    bbedit $MANTEXT/$1.txt
  fi
else
  echo "BBEdit is not installed!"
fi
[robg adds: This worked for me as described; just make sure you change the MANTEXT line to point to the directory you'll use to hold the text versions of the pages.]
    •    
  • Currently 3.20 / 5
  You rated: 3 / 5 (5 votes cast)
 
[10,452 views]  

A script to open man pages in BBEdit | 5 comments | Create New Account
Click here to return to the 'A script to open man pages in BBEdit' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to open man pages in BBEdit
Authored by: jantonc on Jan 04, '06 08:49:04AM

a simple version of this is

man some-page | col -b | bbedit - --view-top --separate-windows -t "some man page"

no files required. gets the latest copy of the man page. you can save it if you wish. Positioned at the top, titled.



[ Reply to This | # ]
A script to open man pages in BBEdit
Authored by: yanokwa on Jan 04, '06 02:24:56PM
For some reason, zsh aliases aren't working with this command. Anyway, the function below works.

bman() { command man $* | col -b | bbedit - --view-top --separate-windows -t "$*"}


[ Reply to This | # ]
A script to open man pages in BBEdit
Authored by: miedreich on Jan 04, '06 09:12:49AM
I use a similar version (with TextWrangler installed, which provides the edit command)

#!/bin/bash
mpg=$*;
if [ ! $1 ];then
        echo "Enter man page to read: ";
        read mpg;
fi
man $mpg | col -b | /usr/bin/edit
(adapted from the postscript version from a previous post)
Important change is the use of $* in the second line, so you can access sections (like man 5 crontab)

[ Reply to This | # ]
Shell worksheets
Authored by: urpaign on Jan 04, '06 11:39:30AM
You can also just type
man whatever
in a BBEdit shell worksheet and press enter. Not as slick as getting there from Terminal.app, but if you're in BBEdit anyway, shell worksheets are quite useful.

[ Reply to This | # ]
A script to open man pages in BBEdit
Authored by: gregraven on Jan 04, '06 02:32:36PM

I still prefer Bwana (http://www.bruji.com/bwana/), which allows you to view nicely formatted man pages in Safari, with links to other man pages.

---
--
Greg Raven
Apple Valley, CA



[ Reply to This | # ]