为什么标准输入关闭时脚本命令不返回正确的退出代码?

为什么标准输入关闭时脚本命令不返回正确的退出代码?

简单的说:

$ script -V
script from util-linux 2.23.2
$ cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
$ false && echo This is correct.
$ script -qefc "false" && echo Also correct.
$ script -qefc "false" 0<&- && echo Why is this printed?
Why is this printed?

编辑:添加了 centos 和脚本版本。

相关内容