Read file line by line and perform action for each in bash

前端 未结 3 1869
-上瘾入骨i
-上瘾入骨i 2020-12-18 15:09

I have a text file, it contains a single word on each line.

I need a loop in bash to read each line, then perform a command each time it reads a line, using the inpu

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-18 15:57

    How about:

    while read line
    do
       echo $line
       // or some_function "$line"
    done < testfile.txt
    

提交回复
热议问题