linux - 用于在 ubuntu 上运行 sublime text 3 的终端命令

标签 linux ubuntu terminal

我已经使用 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 --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 个文件。

关于linux - 用于在 ubuntu 上运行 sublime text 3 的终端命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30762571/

相关文章:

linux - 内核空间和用户空间之间的帧传输

linux - 如何在 RHEL 5 (Linux) 中卸载然后安装 Java 我遇到错误?

android - Windows 上的 Ubuntu 上的 Bash,编译 AOSP

linux - 为什么 sed 将此替换的结果评估为 8?

linux - Unix/Linux终端,如何显示特定字母后跟其他字母?

java - 如何在 Ubuntu 上为 React-native 安装 Java(openjdk)

java - 命令: pkill -INT -f '^php test_program.php$' 的疑问

ruby - RVM ruby​​ 版本 2.2.1,实际 ruby​​ 版本 1.8.7

java.lang.OutOfMemoryError : Java heap space Hadoop Ubuntu 错误

php - 在终端中安装 xdebug