Bash不同版本Source行为不一致

2021-06-10  本文已影响0人  iidx

一、目录结构

#! /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

上一篇 下一篇

猜你喜欢

热点阅读