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.

Subscribe to RSS - stdout