commit - d907d2f55bfe8bc9e0b43044eeafd1d39947257f
commit + 6625fc6b7d2a6b7f3e02a64cb42b4960fe607679
blob - 1c0161acb60b952b78ac929cb1d110df9db65728
blob + f16953b276a6b77891369c1b9246df55bcd480f2
--- art/015.cron_tricks.txt
+++ art/015.cron_tricks.txt
bjob) bjob_command ;;
esac
-And make it executable with `chmod 755 ~/bin/cjob`.
+And make it executable with `chmod 755 ~/bin/cjob'.
The cronjobs themselves would look something like so:
You can use printf(1) to get newlines in your commands, though you'll
have to escape the backslash twice:
-*/10 */2 * * * printf '%s\\n%s' "hey bob" "it's $(date +%H:%M)" | mail -s hey bob
+*/10 */2 * * * printf '\%s\\n\%s' "hey bob" "it's $(date +\%H:\%M)" | mail -s hey bob
Or if you want to have a special character standing for newline, (e.g.
@) you can do that with tr, or sed:
-*/10 */2 * * * echo "hey bob@it's $(date +%H:%M)@Made With tr(1)" | tr @ \\\\n | mail -s hey bob
-*/10 */2 * * * echo "hey bob@it's $(date +%H:%M)@Made With sed(1)" | sed s/@/\\\\n/g | mail -s hey bob
+*/10 */2 * * * echo "hey bob@it's $(date +\%H:\%M)@Made With tr(1)" | tr @ \\\\n | mail -s hey bob
+*/10 */2 * * * echo "hey bob@it's $(date +\%H:\%M)@Made With sed(1)" | sed s/@/\\\\n/g | mail -s hey bob
(Note the doubly-escaped backslashes in all of the above!)