EDITOR

pudge on 2003-08-28T03:03:01

I use BBEdit as my editor, and in the command line, like to use the "bbedit" command-line tool, which opens a file with BBEdit. So I set my EDITOR var in the environment to "bbedit".

But this doesn't work when the program calling EDITOR needs to wait for the file to be done (such as in cvs commit). So there is a "-w" option that means "wait," so the command-line tool does not return until the window is closed. Coolio, so I set EDITOR to "bbedit -w".

Except that some programs (like with crontab -e) like to be smart and check to see if EDITOR is executable, and there is no executable named "bbedit -w". So I wrote a really complex program to set as my EDITOR, called "bbeditw":

#!/usr/bin/perl system "bbedit", "-w", @ARGV;


no comments

jjohn on 2003-08-28T14:44:28

You should really comment that program! How will you know what it does 6 months from now? Perl is hard to read without comments.

I shouldn't comment

phillup on 2003-08-28T17:45:41

Line one is a comment... that's half the code. ;-)

EDITOR

nkuitse on 2003-08-28T22:56:15

Add the -c switch to automatically create non-existent files.

Re:EDITOR

pudge on 2003-08-28T23:10:20

Funny, that's never come up. I guess everything I use that uses EDITOR creates the file first.