我已经使用 Ubuntu 14.02 安装了一台新的开发机器。我还安装了所有相关软件。 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 --help
或 subl --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 个文件。
关于linux - 用于在 ubuntu 上运行 sublime text 3 的终端命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30762571/