NAME
open, appopen, run, unhide, openAs - open files and applications

SYNOPSIS
open [-a app] [-o file] [-p] [-NXHost hostname] [-unhide] [-nostat] [-wait] [-temp] [-tmpdir directory] [-connectp] [-pause n] [-as extension] [+linenum] [filename] ...
appopen app
run app
unhide app
openAs extension [options]
app [options]
app.client [options]

DESCRIPTION
The open command allows shell scripts or Terminal users to make requests to NEXTSTEP applications. The applications may be launched or unhidden, can be asked to open or print files. Besides the added options, it should behave exactly like earlier (working) versions of NeXT's open command did. It does not require the ``Public Window Server'' switch (a major security hole) in the Preferences application to be turned on to work correctly.

If no options are given at all or the special file name ``-'' is used, standard input is read. PostScript (.ps), Encapsulated PostScript (.eps), and Rich Text Format (.rtf) files are recognized on standard input and sent to the appropriate applications. All other files are considered typeless, i.e. they are opened in either the named application (see -a) or the default application (normally Edit).

Wherever the word file is used, it also applies to wrappers and ordinary directories.

OPTIONS

-a app	All further requests are directed to the named application. The application is launched if it is not running yet. If no -a option is given, the Workspace is asked for the default application for the files.

-o file	The application will be asked to open the named file. This option can be used to switch back from print mode or to prefix a file name which could be mistaken as an option. File names can also be escaped from being mistaken as an option by prefixing them with `./' (this also works with all other commands).

-p	The application will be asked to print the specified files. Print mode will apply to all files given up to the next -o option.

-NXHost hostname	All requests are directed to the Workspace and applications on the remote host. The files to be accessed are looked for on the remote host's file system. This option requires the ``Public Window Server'' switch on the remote host to be turned on, which is major security hole, if you are connected to a network.

-unhide	The named application is unhidden. Most applications will also unhide on a file opening request.

-nostat	The checks whether the next file to be opened or printed does not exist will not be performed. In case of failure of a request to an application, it is not possible to find out whether the file did not exist or the application could not open it. It is necessary for -NXHost, unless there is also a local file with the same name as the remote file. This option also allows certain applications (such as Emacs) to open files that do not exist yet.

-wait	open will not continue until the next file given is saved for the first time.

-tmpdir directory	Sets the directory where the file read from stdin is to be temporarily stored. This is needed to be set to a network-wide accessible directory if you want to open a file from stdin on another host.

-temp	The next file will be opened as a temporary file. This tells the application it should remove the file when it is done. Despite it belongs to the official API, only few applications (such as Preview) honor this request.

-connectp	Check if there is a Workspace to connect to. Useful in scripts, exits with 0 if connections are possible, 1 if not.

-pause n	Wait for n seconds before continuing.

-as extension	The next files will be opened as if they were of the given type. To return to the normal behaviour, you have to explicitely select an application with the -a option. This is implemented by creating a symbolic link whose name has the form "/tmp/basename######.type", where ###### is some number.  Note: depending on the application, doing a "Save" may or may not affect the original file.

+linenum	In the next file, line number linenum will automatically be selected. This is currently only supported by Edit and Emacs.

ALTERNATE NAMES
open can also be invoked by other names, where some options are set by default.

run app, appopen app	Behave as if it was invoked as open -a app.

unhide app	Identical to open -a app -unhide.

openAs extension	Identical to open -as extension.

app	If open is invoked with any other name, it behaves as if it were called as open -a app.

app.client	Identical to open -a app -wait.

EXAMPLES

open *.rtf	opens all files ending in `.rtf' in the default application for this file type (usually Edit).

open -p *.rtf	prints all these files.

open /tmp	opens up a new file viewer showing the contents of the named directory.

appopen Yap Test.ps	launches Yap (if it is not already running) and asks it to open Test.ps.

Emacs *	opens all files in Emacs (`Emacs' needs to be a link to `open').

Emacs.client snd.2935	asks Emacs to open the file.  open will not continue unless the file has been saved. This is an alternative to using emacsclient as your editor from within Unix programs.

openAs snd test	opens the file test as if it had the extension snd. You can use this if you know the type of a file but don't know what the default Application for this file type is.

htmlize file | open -as html	Open the data read from standard input as if it was stored in a file which had the extension html.

BUGS
The -p, -temp and +linenum options are only supported by few applications.

-NXHost should imply -nostat.  The current behaviour is compatible to the original open.

-NXHost requires ``Public Window Server'' (a major security hole) to be turned on (this is not our fault).

AUTHORS
This version of open was written by Christian Limpach <chris@nice.ch>, with suggestions by Felix Rauch <felix@nice.ch> and Marcel Waldvogel <waldvogel@uptime.ch>. This manual page was written by Marcel Waldvogel.