Bash - for i in cat?

bash, linux

Solution

Probably

for i in $(cat /root/list.txt)

Problem

I'm not a bash scriptor, so this is no doubt a very simple question. I have a bash script throwing an error. It looks like this: ``` #!/bin/bash for i in (cat /root/list.txt) do doSomething done ``` The error is on the second line, related to the curly brackets. So it seems curly brackets shouldn't be here... in which case, what should line 2 look like? The script is supposed to read each line out of /root/list.txt and then doSomething with this (I removed the actual command for this example.) Thanks!

Original source