Say I have this file:
hello
world
hello world
This program
#!/bin/bash
for i in $(cat $1); do
echo "tester: $i"
done
outputs
tester: hello
tester: world
tester: hello
tester: world
I'd like to have the for iterate over each line individually ignoring whitespaces though, i.e. the last two lines should be replaced by
tester: hello world
Using quotes for i in "$(cat $1)"; results in i being asigned the whole file at once. What should I change?