Only print fortunes in terminals

This modification prevents conflicts with programs that try to read stdout from a login shell.

For example, see https://github.com/brunophilipe/Cakebrew/issues/59