I'm trying to read the output from crontab -l
to verify that the cronjob got added correctly.
Output of crontab -l
right now is:
0 */3 * * * ~/scripts/snapshot.sh
(which is what it should be).
My script to check is the following:
#!/bin/bash
if `crontab -l` = "0 */3 * * * ~/scripts/snapshot.sh"; then
echo "Done creating a cronjob"
else
echo "NOTICE: Failed creating a crontab"
fi
I've tried multiple ways and none worked, if I do the following:
#!/bin/bash
croncheck=`crontab -l`
echo $croncheck
#or
#echo `crontab -l`
The output shows this:
0 */3 cronjobs scripts test.sh cronjobs scripts test.sh cronjobs scripts test.sh ~/scripts/snapshot.sh
Instead of what it should show (what it should be).