Testing if stdout is empty in bash

So, you want to check if something's in LDAP…ldapsearch, right?

Well, that works fine if you're a human…but if you're trying to script it - say, because you're trying to puppetise something - it's a little harder. Because ldapsearch provides an exit code of 0, irrespective of whether it matches any entries. It only returns a failure exit code if the query syntax is invalid.

Colouring in bash for OS-X

I like colours. I like things to stand out. Most of all, I like to be very very clear which computer I'm using when I'm typing in commands (init 0; wait-no-that wasn't the production server, was it?!)

Blog tags:

Subscribe to RSS - bash