On 2013-09-15 11:52, Nick Sabalausky wrote:
Windows actually does the same thing, except the filename *is* the
command:
$ file.txt
And yea, either way, "open file.txt" or "file.txt", it is kinda nice.
Although I find I use it very rarely, oddly enough.
I mostly use "open" to open a directory in the file browser:
$ open .
That's especially useful when opening hidden folders. When opening text
documents or source code, most of the time I open with TextMate, which
has it's own command:
$ mate main.d
By default the shell will not wait for the application. I can force the
shell to wait with the -w flag, this is useful when writing git commit
messages.
Hmm. What's the benefit over just doing this?:
$ /Applications/TextEdit.app foo.txt
$ /Applications/TextEdit.app foo.txt
-bash: /Applications/TextEdit.app: Is a directory
.app "files" are bundles, that is, directories which Finder and other
tools treat specially.
The actual executable is located at
/Applications/TextEdit.app/Contents/MacOS/TextEdit
In the case of TextEdit, running:
$ /Applications/TextEdit.app/Contents/MacOS/TextEdit foo.txt
Will complain that foo.txt doesn't exist. The shell will also wait until
the application terminates. Running through "open" the shell will not
wait for the application and it will open the document properly.
--
/Jacob Carlborg