shell 逐行组合文本内容

shell 逐行组合文本内容

#!/usr/bin/env bash
#              ^^^^-- NOT /bin/sh

readarray -t a <n.txt   # read each line of file1 into an element of the array "a"
readarray -t b <z.txt   # read each line of file2 into an element of the array "b"
for itemA in "${a[@]}"; do
  for itemB in "${b[@]}"; do
    printf '%s%s\n' "$itemA" "$itemB"
  done
done

# Shell  

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×