Q:

Ldap search with negative parameter

I'm trying to do a search on my LDAP base like that:
ldapsearch  -x -h localhost -p 389 -D uid=xxxadmin,ou=administrators,ou=topologymanagement,o=netscaperoot -v -w 12345 -b "ou=Usuarios,ou=Alunos,ou=XXXX,o=xxXXXxx" -f (!(objectClass=ntUser)) 1.1

Basically I want to list all the entries without the objectClass ntUser and add the objectClass to them.
I'm getting this as an answer:
-bash: !: event not found

A:

From http://www.openldap.org/lists/openldap-software/200104/msg00196.html

This message comes from the shell (bash). It states that the command
  `!' didn't find the event you unintentionally asked for. This happens
  because the double quotes in bash do not prevent some command
  invocation. Use single quotes instead:

Your search should be like this:
ldapsearch  -x -h localhost -p 389 -D 'uid=xxxadmin,ou=administrators,ou=topologymanagement,o=netscaperoot' -v -w 12345 -b 'ou=Usuarios,ou=Alunos,ou=XXXX,o=xxXXXxx' -f '(!(objectClass=ntUser))' 1.1

