使用命令行命令在

使用命令行命令在

本文介绍了使用命令行命令在 OS X 上启动 Sublime Text 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始阅读 Michael Hartl 关于 Rails 的书,但在设置阶段遇到了一个问题.Hartl 一直提到在我的主目录中创建一个文件,但我不太确定如何执行此操作.例如,当我尝试为 sublime text 设置命令行时,说明告诉我这样做:假设您已将 Sublime Text 2 放在 Applications 文件夹中,并且您的路径中有一个 ~/bin 目录,您可以运行:

I just started reading Michael Hartl's book on Rails and I've run across a problem in the setup phase. Hartl keeps referring to making a file in my home directory, but I'm not quite sure how to do this. For example, when I try to setup the command line for sublime text the instructions tell me to do this: Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run:

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

我的问题是我不知道如何在我的路径中放置 ~/bin 目录.我知道这是非常基本的,但任何帮助都会非常感激.

My problem is that I don't know how to put a ~/bin directory in my path. I know this is real basic but any help would be greatly appreciation.

推荐答案

创建或编辑 ~/.profile(适用于 bash 和 zsh)

create or edit ~/.profile (works with both bash and zsh)

添加以下内容

导出路径=$PATH:$HOME/bin

上面这行是说,覆盖PATH环境变量,设置为之前的路径加上~/bin

The line above is saying, overwrite the PATH environment variable and set it to the previous path plus ~/bin

现在,当您尝试运行命令时,bash 将在您的 PATH 环境变量中查找所有以冒号分隔的路径以查找可执行文件.

Now when you try to run a command, bash will look in all the colon separated paths in your PATH environment variable for an executable.

要查看整个 PATH,请在终端中输入 echo $PATH.或者更好的是,输入 env 以查看所有环境变量.

To see your entire PATH, type echo $PATH in a terminal. Or better yet, type env to see all environment variables.

这篇关于使用命令行命令在 OS X 上启动 Sublime Text 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 05:45