Creating an array from a text file in Bash

前端 未结 6 1811
小鲜肉
小鲜肉 2020-11-22 10:25

A script takes a URL, parses it for the required fields, and redirects its output to be saved in a file, file.txt. The output is saved on a new line each time a fie

6条回答
  •  北海茫月
    2020-11-22 11:05

    You can do this too:

    oldIFS="$IFS"
    IFS=$'\n' arr=($(

    Note:

    Filename expansion still occurs. For example, if there's a line with a literal * it will expand to all the files in current folder. So use it only if your file is free of this kind of scenario.

提交回复
热议问题