可能重复:
Looping through the content of a file in Bash?如何使用shell遍历外部文件中的行?
我有一个文件,名称的列表。我需要使用shell脚本从外部文件中遍历该文件中的所有名称。我怎样才能做到这一点?
实施例的文件:
脚本/ names.txt中
alison
barb
charlie
david
脚本/ script.sh
NAMES="" #names from names.txt file
for NAME in $NAMES; do
echo "$NAME"
done
我怎样才能爆炸文件names.txt到一个数组中的单独shell脚本?
如何链接到原来的Q&A? – bearvarine 2015-09-28 16:17:36