BASH 脚本中的导出关键字
我正在尝试在我的 Ubuntu 笔记本电脑上安装 PETSc。安装的第一步是在终端的 PETSc 目录的顶级目录中调用以下命令。
export PETSC_DIR=$PWD
./config/configure.py --with-cc=gcc --with-fc=gfortran --download-f-blas-lapack=1 --download-mpich=1
make all test
问题 1:我是否应该实际输入“PWD”一词或顶级 PETSc 目录的地址?
问题2: 我想了解导出关键字的一般用途,特别是它在示例中的用途。我查看了一些关于导出关键字的参考文献,但所有这些参考文献都没有真正解释清楚。可能我一直在错误的地方寻找。
我从未编写过任何 shell 脚本,因此详细的答案将非常有帮助...非常感谢!
I am trying to install PETSc on my Ubuntu laptop. The first step of the installation is to invoke the following commands in the top level directory of the PETSc directory in the terminal.
export PETSC_DIR=$PWD
./config/configure.py --with-cc=gcc --with-fc=gfortran --download-f-blas-lapack=1 --download-mpich=1
make all test
Question 1: Should I actually enter in the word 'PWD' or the address of the top level PETSc directory?
Question 2:
What I wanted to understand what the export keyword does in general and in particular what it does in the example. I have looked at some references on the export keyword and all of them did not really explain clearly. Probably I have been looking in the wrong places.
I have never done any shell scripting so a detailed answer would be very helpful...Thank you so much!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
export
所做的只是使环境变量的值可供子进程使用。在这种情况下,他们假设您位于 PETSc 目录的顶级目录中。因此,使用 $PWD(打印工作目录)只是一个快捷方式,因此您不必键入路径。效果应该是相同的:
All
export
does is make the value of an environment variable available to child processes.In this case, they're assuming that you're in the top level directory of the PETSc directory. So using $PWD (print working directory) is just a shortcut so you don't have to type out the path. The effect should be identical: