运行 sublime text 3 的终端命令从 ubuntu 开始

terminal command for running sublime text 3 from on ubuntu

我使用 Ubuntu 14.02 安装了一个新的开发 machine。我还安装了所有相关软件。 php/apache2/sublime/composer等

我希望能够在终端中使用 sublime 或 subl 命令打开文件,但似乎无法找到正确指向内容的命令。

我的 sublime 可执行文件位于此处... /opt/sublime_text/sublime_text

在/usr/bin/subl我有命令

#!/bin/sh
exec /opt/sublime_text/sublime_text "$@"

我只是在终端中找不到实现它的命令。 sublime 文档指向 mac 说明,但我太新手无法翻译。

有什么建议吗?

shell 脚本中的

$@ 基本上复制给 shell 脚本的所有参数(在脚本名称之后),并将它们放在脚本执行期间的那个位置.

例如, 如果你要 运行 subl test.txt,就好像你 运行 宁 exec /opt/sublime_text/sublime_text "test.txt"

现在,/opt/sublime_text/sublime_text --helpsubl --help 为我们提供了说明用法的帮助文本。

Sublime Text build 3065

Usage: sublime_text [arguments] [files]         edit the given files
   or: sublime_text [arguments] [directories]   open the given directories

Arguments:
  --project <project>: Load the given project
  --command <command>: Run the given command
  -n or --new-window:  Open a new window
  -a or --add:         Add folders to the current window
  -w or --wait:        Wait for the files to be closed before returning
  -b or --background:  Don't activate the application
  -h or --help:        Show help (this message) and exit
  -v or --version:     Show version and exit

Filenames may be given a :line or :line:column suffix to open at a specific
location.

如果您传递了多个参数,那么所有参数也将被一视同仁。所以,如果你 运行 subl file1.txt file2.cpp file3.html 那么它会打开所有 3 个文件。

根据 Mathias 在我的问题中的评论,我在这里找到了答案...

How can I open Sublime Text 2 files from the command line in linux to a tab, not a new window