Grep result to a shell variable – no line breaks

bash-shellThere was this website containing regularly updated content I wanted to follow. Unfortunately, they had no RSS feed available and I didn’t feel like checking on the website every now and then. Also, what I needed was just the posts containing particular keywords in the Title. So I wrote a tiny script to do the mundane task for me and let me know when the keywords I was interested in would appear:

However, grep would return only one line with all the results when assigning the result to the $RESULT variable, not line by line as it deos when printing to the standard output. The problem turned out to be bad usage of echo. echo $RESULT had to be replaced by echo “${RESULT}, my bad, after that the script worked just fine.

Tagged with: , ,