I am working on a BASH script which creates automated backups via the crontab. I am trying to use
myVARIABLE=`grep backup /etc/crontab`
to return lines containing "backup" if an entry has already been made. Instead of returning lines from
/etc/crontab it seems to be returning the output of multiple ls commands. I have run the command
grep backup /etc/crontab
from the command line and it works as expected. I can also grep other files via my BASH script and it returns expected results as well. Any thoughts as to why
/etc/crontab causes grep problems within a script? Thanks!