$ {path}如何工作,在本教程中 [英] How does ${path} work, in this tutorial

查看:216
本文介绍了$ {path}如何工作,在本教程中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信这是在这个网站上最蠢的问题之一,但我是非常新的linux,和一些我的深度。我正在处理此教程和上午



对于这一个,教程告诉我使用这个:

  export PATH = $ {PATH}:$ {DTITK_ROOT} / bin:$ {DTITK_ROOT} / utilities:$ {DTITK_ROOT} / scripts 



我已经定义了DTITK_ROOT,并且对上述说明有几个问题。


  1. 应该将$ {}留在DTITK_ROOT周围吗?

  2. 我的DTITK_ROOT是我提取的程序的完整路径(我认为这是正确的术语)

  3. 在这种情况下,我为$ {PATH}写什么?我明白我应该用东西代替它,但我不知道什么。我尝试的一切都不通过验证步骤。

对不起,如果它看起来像一个蠢或真的简单的问题,但我甚至不知道任何关键字到google,以找到如何得到答案。

解决方案


  1. 是的。这是如何访问存储在 DTITK_ROOT 中的路径。这称为参数扩展。您可以阅读更多相关资讯


  2. 不,不要更改任何内容。此外,与相对路径相比,更常用的术语是绝对路径。绝对路径是从根目录 / 的路径。相对路径是从当前工作目录的路径。您可以阅读更多有关路径的信息,以及绝对路径和相对路径之间的区别此处


  3. 您不能替换任何东西。同样,参数扩展起作用,这将被已经存储在您的路径变量中的内容替换。所以真正所有这个命令是做你的路径变量,添加一些更多的路径,然后将它存储回你的路径变量。如果您不知道,path变量包含您要执行的所有可执行文件的路径,而不必键入完整路径。 这里是关于路径变量以及其他环境变量的一个很好的讨论。



I'm sure this is one of the dumbest problems asked on this site, but I am very new to linux, and a little out of my depths. I'm working off of this tutorial here and am stuck on the "add the path" and verify steps.

For this one the tutorial told me to use this:

export PATH=${PATH}:${DTITK_ROOT}/bin:${DTITK_ROOT}/utilities:${DTITK_ROOT}/scripts

I have already defined DTITK_ROOT, and have a few questions about the above instructions.

  1. Should the ${} be left around the DTITK_ROOT?
  2. My DTITK_ROOT is the full path (I think that's the right term) to the file I extracted the program to, should I change that?
  3. What do I write for ${PATH} in that case? I understand that I'm supposed to replace it with something, but I don't know what. Everything I've tried doesn't pass the verify step.

I'm sorry if it seems like a dumb or really simple question, but I don't even know any keywords to google in order to find how to get the answer.

解决方案

  1. Yes. This is how you access the path stored in DTITK_ROOT. This is called parameter expansion. You can read more about it here.

  2. No, don't change anything. Also, a more commonly used term is absolute path, in comparison to relative path. The absolute path is a path from the root directory, /. Relative path is a path from your current working directory. You can read more about paths in general and the difference between absolute and relative paths here.

  3. You don't replace it with anything. Once again, parameter expansion comes into play and this will be replaced with what is already stored in your path variable. So really all this command is doing is taking your path variable, adding some more paths to it, and then storing it back into your path variable. If you didn't know, the path variable contains paths to all executable files that you would like to execute without typing the full path. Here is a good discussion on path variables, along with other environment variables.

这篇关于$ {path}如何工作,在本教程中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆