Closed leoj3n closed 10 years ago
I'm sorry but there's no way the parser can expect random text before the output data. It is a question of computability. The algorithm would require a lot of resources even for those who don't have such a thing in their terminal and I believe it is not worth it.
It's okay, I was able to fix the fortune script by changing it from
# Print a random, hopefully interesting, adage.
if (( $+commands[fortune] )); then
fortune -a
print
fi
to
# Print a random, hopefully interesting, adage.
if (( $+commands[fortune] )); then
if [[ -t 0 || -t 1 ]]; then
fortune -a
print
fi
fi
Which is probably best practice.
Still, -l
seems cumbersome when garbage (from errors, a sysop message, or whatever else) may be printed at the beginning of a login shell.
I haven't come across this kind of message before, but I would believe they would be sent through std_error
instead of std_output
, so Cakebrew would be safe from reading them since for formula listing it ignores std_error
.
My setup echoes a fortune every time a new user shell is opened.
This gets picked up by Cakebrew. :panda_face: