BBEDIT

Section: BBEdit Command Line Reference (1)
Updated: Bare Bones Software
Index Return to Main Contents
 

NAME

bbedit - It doesn't suck.  

SYNOPSIS

bbedit [ -bchlpsuvVw --(long_form_switches) ]
  [ -e <encoding_name> ] [ -t <string> ]
  [ +<n> ] [ file (or) <S/FTP URL> ... ]  

DESCRIPTION

The bbedit tool is a simple utility that allows you to open files in BBEdit via the command line. Type 'bbedit' followed by a list of file names to open the specified files for editing in BBEdit.

In addition to files, you can also specify FTP or SFTP URLs to files or directories, to have BBEdit open the specified files, or an FTP/SFTP browser for each directory. You will be prompted to enter passwords if necessary.

        [Not all file switches are supported when using the bbedit tool 
        with URLs. This includes line number jumping, --encoding, 
        --print.]

For example, to open a local file:

        bbedit ~/myfile.txt

To open a file from a remote server via FTP:

        bbedit ftp://myserver.example.com/my/file/path/remote_file.txt

To open an FTP/SFTP Browser for a remote server directory via SFTP:

    bbedit sftp://user@myserver.example.com/home/a_user/

You can also pipe stdin to the bbedit tool, and it will open in a new untitled window in BBEdit. For example:

        ls -la | bbedit

If you invoke the bbedit tool with no parameters, it will accept stdin from the terminal; terminate with control-D (end-of-file) to send it to BBEdit.

The bbedit tool is also suitable for use as your EDITOR environment variable. See the -w option below for details.

BBEdit is a commercial text editor from Bare Bones Software.  

OPTIONS

Single-character switches may be clustered together. For example, the following two commands are equivalent:

        bbedit -bp filename
        bbedit -b -p filename

Use ``--'' to end switch parsing. For example, to open a file named ``-z'', use:

        bbedit -- -z

Most arguments have both a single-character short form (preceded by one dash), and a long form (preceded by two dashes).

The switches ``--front-window'', ``--new-window'', and ``--separate-windows'' are mutually exclusive: you may only specify one for a given invocation of the tool. In addition to controlling how BBEdit handles opened files, these switches apply when creating files and when piping to the tool, but are ignored for URL arguments.

+<line number>
Go to line number. For example, to select line 33:

        bbedit +33 filename

-b, --background
Launch BBEdit in the background if it's not already running, or keep it in the background if it is. If this option is absent, BBEdit will come to the foreground after the files are opened.
--clean (no short variant)
Piped data will be placed in an untitled document whose state is initially clean (unmodified) so that if you do not further edit the data, you can close the document without confirmation.
-c, --create
Create the specified files, unless they exist already, in which case they are opened. The new files are created empty, with the standard Unix type and creator (i.e. none). Line endings are determined by the ``Default Line Breaks'' setting in the ``Text Files: Saving'' panel of BBEdit's Preferences window. (Use the -u option to force Unix line endings.)
-e, --encoding
Specify the internet name of an encoding to open a file using that encoding.

        bbedit --encoding iso-8859-1 foo.txt
        bbedit --encoding utf-8 foo.txt

--front-window (no short variant)
Opens the specifed files into the frontmost text window. If there is no text window open, BBEdit will create one.
-h, --help
Display a basic help line with a summary of the available options.
-l, --launch
Launch BBEdit (or activate it, if it's already running), without opening any files.
--new-window (no short variant)
Opens the specifed files into a new text window.
-p, --print
Print the specified files on your currently selected printer.
-t, --pipe-title
Uses the specified string as the title of the window which holds the pipe contents, so you can more easily locate it later.

        ls -al | bbedit -t "My Directory Listing"

-u, --create-unix
Create the specified files, unless they exist already, in which case they are opened. New files are created with Unix line endings. This option is useful if you wish to create a file with Unix line endings, but have Mac line endings specified as the default for files created within BBEdit (see the ``Text Files: Saving'' panel in BBEdit's Preferences window).
-s, --worksheet
Create a new shell worksheet file with the specified name, unless such a file exists already, in which case it will be opened.
--separate-windows (no short variant)
Opens each of the specified files into its own text window.
-v, --version
Display the current version number of the bbedit command line tool and the BBEdit application.
-V, --short-version
Display the short-form version number of the bbedit command line tool.
--view-top (no short variant)
Piped data will be placed into a new document which will have its scrollbar positioned at the top rather than the end (the default behavior).
--resume (no short variant)
Used in combination with -w or --wait, this switch will cause the application which was frontmost when the bbedit tool was invoked to be made frontmost again once you close the file(s) specified on the command line.

This is convenient if you are using the Terminal (or any third-party equivalent) to invoke a command which uses BBEdit as its editor (p4, cvs), and want to return back to the Terminal when the editing session is over.

        bbedit --wait --resume  ~/foo.txt

-w, --wait
Wait until the file is closed in BBEdit. Normally, the bbedit tool exits immediately after the file arguments are opened in BBEdit. The -w option allows the bbedit tool to be used as an external editor for Unix tools that use the EDITOR global environment variable. To make this work using tcsh, add the following line to your .cshrc (or .tcshrc) file:

        setenv EDITOR "bbedit -w"

Some tools (notably crontab), will not work correctly if your EDITOR variable consists of multiple terms. You can work around this by creating a simple shell script that calls bbedit -w, then using the shell script as your EDITOR. For example:

    #!/bin/sh
    bbedit -w "$@"

 

AUTHORS

 Bare Bones Software, Inc.
 Web site: http://www.barebones.com/
 Email: support@barebones.com


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
AUTHORS

This document was created by man2html, using the manual pages.
Time: 20:09:01 GMT, December 02, 2024