How to add to a crontab without creating duplicates.

crontab -l | grep 'myscript.sh' || (crontab -l 2>/dev/null; echo "45 10 * * * /path/to/myscript.sh") | crontab -