Archive for November, 2007

Wrapping ‘defaults’ to be more flexible…

Thursday, November 22nd, 2007

So I don’t know about any of you, gentle readers, but ‘defaults’ really gives me the shits sometimes.

Exhibit A:

/ $ defaults read /Library/Preferences/com.apple.loginwindow.plist
2007-11-21 13:12:04.288 defaults[97501:10b]
Domain com.apple.loginwindow.plist does not exist
/ $ defaults read /Library/Preferences/com.apple.loginwindow
(snip actual working output)

Exhibit B:

  / $ cd /Library/Preferences
/Library/Preferences $ defaults read ./com.apple.loginwindow.plist
2007-11-21 13:13:24.327 defaults[97540:10b]
Domain ./com.apple.loginwindow.plist does not exist
/Library/Preferences $ defaults read ./com.apple.loginwindow
2007-11-21 13:13:25.799 defaults[97546:10b]
Domain ./com.apple.loginwindow does not exist

This really annoys me, that ‘defaults’ firstly doesn’t accept the full path to the plist, when other tools like ‘launchctl’ do, and requires that you strip off the “.plist” from the end, and secondly, that you can’t use relative paths.

This annoyed me so much that I decided to finally do something about it. This function resolves both problems.

function defread { defaults read $(echo "$@" | sed "s|\./|`pwd`/|g" | sed "s|.plist||g"); }

And now we can do:

/ $ defread /Library/Preferences/com.apple.loginwindow.plist
/ $ cd /Library/Preferences
/Library/Preferences $ defread ./com.apple.loginwindow.plist

or even:

/Library/Preferences $ defread ./com.apple.loginwindow.plist SHOWFULLNAME
1

mmmm.

My first earthquake….

Thursday, November 1st, 2007

So last night I experienced my first earthquake ever….

Considering it was a 5.6 and quite close to our house, I’m a little disappointed now that it wasn’t more dramatic… nothing even fell off the shelves. Just several huge thumps that felt like something dropped from a great height into the backyard.

Not to give any impression I didn’t freak out … On the other hand, Chantal having grown up in Tokyo was calm and collected.

I see Bill Baumgarter felt it too...