Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Display a random fortune in the login window' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Display a random fortune in the login window
Authored by: zimmerleut on Nov 18, '04 11:31:13AM
loginfortune.sh as it is here stumbles over double quotes that may be in fortunes. This is how it works for me:

#!/bin/sh
# NOTE: the next two lines must be ONE LINE with a space
# replacing the line break ... broken here for easier reading
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow
LoginwindowText \""$(/sw/bin/fortune | sed s/\"/\\\"/g)"\"


[ Reply to This | # ]

I'm afraid that doesn't run on my box
Authored by: porkchop_d_clown on Nov 18, '04 12:13:06PM

It generates an error about an unterminated expression in SED.

I think somewhere along the way you lost some back slashes? I used

/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText \""$(/sw/bin/fortune | sed s/\"/\\\"/g)"\"

---
Everyone loves a clown, but no one will lend him money!



[ Reply to This | # ]
I'm afraid that doesn't run on my box
Authored by: zimmerleut on Nov 18, '04 01:15:30PM

yeah, my backslashes got lost while posting... thanks



[ Reply to This | # ]
Display a random fortune in the login window
Authored by: apaterso on Nov 19, '04 05:51:18PM

I must be missing something, because I don't get anything to show up.

I have the file

usr/bin/defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText -string "$(/sw/bin/fortune)"

saved as loginfortune.sh I have chmod 755 it, it lives in the /Libarary/Hooks
directory. But no dice, actally all I get is an empty box where the fortune ought to be. Any neat ideas?

Andy



[ Reply to This | # ]