美文网首页
Bash不同版本Source行为不一致

Bash不同版本Source行为不一致

作者: iidx | 来源:发表于2021-06-10 18:23 被阅读0次

一、目录结构

  • a.sh
#! /usr/bin/env bash
# a.sh 文件内容
source a.txt   # a.txt文件不存在
echo 123
# 开个终端,执行
bash a.sh

二、不同版本的bash行为不一致

  1. bash 4.1.2 返回
./a.sh: line 1: a.txt: 没有那个文件或目录
1        # !!!!!
  1. bash 4.2.46(Centos7.5+)
./a.sh: line 1: a.txt: 没有那个文件或目录

附: 查看bash版本

bash --version

相关文章

网友评论

      本文标题:Bash不同版本Source行为不一致

      本文链接:https://www.haomeiwen.com/subject/nvlpeltx.html