It still doesn't work… it still doesn't work… it still doesn't work…

I've heard it said by many programmers I respect that you spend 10% of your time coding, 90% debugging. I would argue it's closer to 5% coding, 95% debugging, but the point stands. It also stands true that the more tired you get, the less obvious basic mistakes appear to be.

Case in point, this evening I decided to update my MacPorts collection on my iBook and install Gnumeric (I've so far only switched to pkgsrc on my MacBook Pro). For the life of me I couldn't figure out why this single line wasn't working:

% sudo port -v selfupdate && \
port -v install gnumeric

If you've worked in UNIX for more than 5 seconds you'd be able to tell me in an instant what I did wrong, but for the last 10 minutes I just couldn't figure it out. It was driving me crazy! When I did I promptly hit my forehead on the table causing a glass of cold water I had placed on it to jiggle its way off the table and with an almighty crash land in a million pieces on the floor.

ASIDE: That glass thing didn’t really happen, but doesn’t it sound like something that could?

Lesson learned, don't do any programming, scripting or shell work when you're half asleep or not feeling well. You just don't get much done!

As for the mistake, I only used one sudo command. Using && doesn't carry over the higher user privileges! Simple, obvious, glaring mistake that was staring me in the face the entire time and I couldn't see it.