在Bash shell里,readarray 和 mapfile 属于同一命令的不同名称,其作用是将输入内容读取到数组中。以下会详细介绍它们的用法: 基本语法 二者的基本语法是一致的,如下所示: readarray [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback