加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

bash脚本中dot的用法

发布时间:2020-12-15 21:34:40 所属栏目:安全 来源:网络整理
导读:以下代码片段中第8行的点是什么意思,来自Mac OS X Mavericks终端中/ etc / profile的来源. 1 # System-wide .profile for sh(1) 2 3 if [ -x /usr/libexec/path_helper ]; then 4 eval `/usr/libexec/path_helper -s` 5 fi 6 7 if [ "${BASH-no}" != "no" ];
以下代码片段中第8行的点是什么意思,来自Mac OS X Mavericks终端中/ etc / profile的来源.

1 # System-wide .profile for sh(1)
  2 
  3 if [ -x /usr/libexec/path_helper ]; then
  4         eval `/usr/libexec/path_helper -s`
  5 fi
  6 
  7 if [ "${BASH-no}" != "no" ]; then
  8         [ -r /etc/bashrc ] && . /etc/bashrc
  9 fi

解决方法

在bash,.是另一种拼写来源的方法.所以这一行与此相同:

# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
        eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
        [ -r /etc/bashrc ] && source /etc/bashrc
fi

source将文件解释为内容包含在源命令的位置.执行它的不同之处在于它可以设置别名或定义函数或变量.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读