2

使用source命令的注意事项

 3 years ago
source link: https://www.lujun9972.win/blog/2019/07/02/%E4%BD%BF%E7%94%A8source%E5%91%BD%E4%BB%A4%E7%9A%84%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9/index.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
使用source命令的注意事项 - 暗无天日

使用source命令的注意事项

我们常用source(或者.)

source FILENAME [ARGUMENTS]
. FILENAME [ARGUMENTS]

来让当前shell环境加载并执行文件中的命令,但是使用该命令要注意几个要点:

  1. 若 ${FILENAME} 不是绝对路径,则source命令 优先从 $PATH 环境变量设置的路径中寻找文件, 找不到的前提下再从当前目录搜寻文件.(该文件不必有执行权限)
  2. source命令的返回值是 FILENAME中最后一条命令的返回值,∗若FILENAME中最后一条命令的返回值,∗若{FILENAME}存在但无任何命令则会返回0*, 若 ${FILENAME} 不存在则返回 1。
2019-07-02 2019-07-09 linux和它的小伙伴 lujun9972

Related Issues not found

Please contact @lujun9972 to initialize the comment

Generated by Emacs 27.x(Org mode 9.x)

Copyright © 2014 - 2021 lujun9972   -   Powered by EGO
Themed with emacs_love


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK