I am writing a very simple script and I'm getting stuck on something stupid. Basically I have text file in which each line is comprised of 3 words separated by a space. When you cat the file it shows everything correctly. For example catting the file looks something like this:
bird dog mouse
ferret bunny hare
I'm doing a simple for loop like this:
for line in $(cat pets.txt)
do
echo $line
"command $line"
done
The echo is showing the problem. The command needs to run as
command bird dog mouse
and instead it is running as
command bird
command dog
command mouse
This seems like it should be a simple fix, but I can't get my search terms right to find the solution.
Thanks!