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

Use a GUI editor with the UNIX Pine mail program UNIX
I am a great fan of the freeware text editor BBEdit Lite, and wanted to use it as my "alternate editor" in the UNIX mail program Pine. I had already been cutting and pasting data between the two applications, but I knew there had to be a more elegant solution.

All of my various experiments didn't work. I couldn't use the 'bbedit' system alias I had set up (thanks to this hint); Pine didn't recognize the alias as an editor. And I couldn't use the raw 'open -a [app name]' command, since Pine demanded that the temporary file exist before it was edited, and Pine also had to be required to wait for me to finish my revisions in BBEdit Lite before taking the file back.

Read the rest of the article for the solution to the problem...

I needed to create a shell script that (a) created a text file with the temporary file name Pine demanded, (b) loaded that text file into BBEdit Lite, and (c) held Pine from coming back until the file was completely edited. And here it is:
touch $1
open -a '/Applications/BBEdit Lite/BBEdit' $1
echo "Press the Enter key to continue ... "
stty -echo
read enter
stty echo
case $enter in
Name this as a script (I named mine 'bb-pine'), make it executable, and then put it into /usr/local/bin (General question: Is there a better or more appropriate place on the system to put shell scripts?). Then put the script (with its full path) into your 'alternate editor' setting in your PINE configuration file:
You should now be able to use BBEdit Lite as your preferred editor in Pine.
  • Currently 2.50 / 5
  You rated: 5 / 5 (4 votes cast)

Use a GUI editor with the UNIX Pine mail program | 11 comments | Create New Account
Click here to return to the 'Use a GUI editor with the UNIX Pine mail program' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Great job!
Authored by: DAC on Jun 12, '02 11:13:04AM

Great hint. The full version of BBEdit has this option, but your hint opens up the collection of editors that can be used. When I write little tools like this, I usually stash them in a personal directory, and just put an sim link to the tool in /usr/local/bin if I need to have it handy from the command line. I have not seen any good rules as to where to put stuff :).

[ Reply to This | # ]
Where to put stuff
Authored by: thinkyhead on Jun 12, '02 03:05:18PM

/usr/local/bin and ~/bin are already in the PATH so these should be fine for stuff like this.

[ Reply to This | # ]
Where to put stuff - exp
Authored by: Accura on Jul 12, '02 10:31:07PM
Most of you will know this but if yo don't here it is.

Use /usr/local/bin for all user to be able to use.
Use /bin for the same but its not really a standard place to put thing.
Use /User/username/bin where username id the user name of the user you want to be able to run this.

[ Reply to This | # ]
What's the touch for?
Authored by: porkchop_d_clown on Jun 12, '02 11:43:21AM

I haven't tried this; I don't use pine - but why do you need the touch? Is it creating the file $1? Wouldn't bbedit do that for you if you gave it the name of a file that doesn't exist?
Also, you referenced an old hint for modifying your .cshrc. OS X users really shouldn't do that - it's a clunky 30 year old technique that can be hard to maintain.
Instead, use Apple's own supplied methods for extending the shell through scripts in your ~/Library/init/tcsh folder. I documented a tool for dynamically building aliases for all your .apps here. It's based on the older hint on ResExcellence, but supports multiple application directories.

[ Reply to This | # ]
Re: What's the touch for?
Authored by: Anonymous on Jun 12, '02 12:30:59PM

It is indeed necessary for the touch command to create the file first. Otherwise, the open command throws an error message out when it tries to have BBEdit Lite open the file and won't go any farther.

[ Reply to This | # ]
What's the touch for?
Authored by: nkuitse on Jun 16, '02 02:45:19PM
If you have the full BBEdit 6.5, set the environment variable EDITOR to bbedit -c -w. The -c switch creates the file if necessary, and the -w switch "allows the bbedit tool to be used as an external editor for Unix tools that use the EDITOR global environment variable" (from the manpage).

[ Reply to This | # ]
Authored by: Fubar on Jun 16, '02 05:42:08PM

Can pine be used to read mail on another system? I'd love to use pine on my powerbook, but it's obviously not set up to have mail delivered directly to it.

[ Reply to This | # ]
Authored by: mirzu on Jul 13, '02 02:29:54AM

Sent to it? No.

If you are asking if it can check pop mail the answer is yes

[ Reply to This | # ]
Use a GUI editor with the UNIX Pine mail program
Authored by: murphyatnetaxs on Mar 05, '03 02:22:05PM

Is your script incomplete? It ends with "case enter in"

[ Reply to This | # ]
Use a GUI editor with the UNIX Pine mail program
Authored by: Anonymous on Mar 20, '03 02:17:50PM

Could be. I grabbed that part from another page on the Web; I just needed something that would wait for a keystroke to be hit before going on, and had no idea how to program that in a shell script, as my shell script programming knowledge is infinitisemas...


It's really, really, really small.

[ Reply to This | # ]
A slightly better script
Authored by: netdpb on Apr 15, '03 12:43:16PM
Try the following. It allows you to choose to revert your changes before returning to Pine.

tmpfile=$(mktemp -t $(basename $0))

touch $1
cp $1 $tmpfile
open -a "Path To Your Favorite" $1
read -e -p "Enter to continue, N to revert: "
if [[ "$REPLY" == [nN]* ]]; then
  cat $tmpfile >$1

[ Reply to This | # ]