Some of these features are specific to OS X, but most are common to all platforms that support shell scripting. Note: This appendix was originally part of Mac Technology Overview.īefore you start working in any shell environment, there are some basic features of shell scripting that you should understand. The following sections provide some basic information and tips about using the command-line interface more effectively they are not intended as an exhaustive reference for using the shell environments. The standard shell is bash if you are running OS X v10.3 or later and tcsh if you are running an earlier version of the operating system. Although you can use any shell of your choice, the examples in this book assume that you are using the standard OS X shell. In addition to running individual tools, most shells provide some means of combining multiple tools into structured programs, called shell scripts (the subject of this book).ĭifferent shells feature slightly different capabilities and scripting syntax. A shell is a special command-line tool that is designed specifically to provide text-based interactive control over other command-line tools. Each Terminal window or SSH connection provides access to the input and output of a shell process. In the modern era, in spite of the ability to transmit graphical user interfaces over the Internet, the command line remains a powerful tool for performing certain types of tasks.Īs described previously in Before You Begin, most users interact with a command-line environment using the Terminal application, though you may also use a remote connection method such as secure shell (SSH). As a workaround, start Sublime Text 2 first via Finder, and then interact with it using subl.Historically, the command line interface provided a way to manipulate a computer over simple, text-based connections. If you have the MacPorts version of Python installed, then starting Sublime Text 2 via the subl will not work correctly. Specifying -w will cause the subl command to not exit until the file is closed. To use Sublime Text 2 as the editor for many commands that prompt for input, set your EDITOR environment variable: To the terminal when a file is closed (only relevant if waiting for a file).įilenames may be given a :line or :line:column suffix to open at a specific h or -help: Show help (this message) and exit s or -stay: Keep the application activated after closing the file b or -background: Don't activate the application w or -wait: Wait for the files to be closed before returning a or -add: Add folders to the current window Ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run: The first task is to make a symlink to subl. This can be used to open files and projects in Sublime Text 2, as well working as an EDITOR for unix tools, such as git and subversion. Sublime Text 2 includes a command line tool, subl, to work with files on the command line. WARNING! This documentation is for an old, unsupported version