Read a file line by line assigning the value to a variable

后端 未结 10 974
说谎
说谎 2020-11-21 07:37

I have the following .txt file:

Marco
Paolo
Antonio

I want to read it line-by-line, and for each

10条回答
  •  南笙
    南笙 (楼主)
    2020-11-21 08:34

    Using the following Bash template should allow you to read one value at a time from a file and process it.

    while read name; do
        # Do what you want to $name
    done < filename
    

提交回复
热议问题