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 input from that line as part of the command.
I am just not sure of the proper syntax to do this in bash. If anyone can help, it would be great. I need to use the line from the test file obtained as a paramter to call another function. The loop should stop when there are no more lines in the text file.
Psuedo code:
Read testfile.txt.
For each in testfile.txt
{
some_function linefromtestfile
}
As an alternative, using a file descriptor (#4 in this case):
Don't use
cat
! In a loopcat
is almost always wrong, i.e.and people might start to throw an UUoCA at you.
Tried this to automate nikto scan of list of domains after changing from cat approach. Still just read the first line and ignored everything else.
How about: