![](https://seccdn.libravatar.org/avatar/e38b9efc16cc3779f80fe2b44bf25433.jpg?s=120&d=mm&r=g)
19 Nov
2004
19 Nov
'04
19:54
I'm trying to do an ldapsearch in a bash script. I need to be able to expand a variable and use a NOT (!). If I use double quotes around the filter like this: ldapsearch "(&(cn=$LOGIN)(!(usertype=student)))" bash complaines about "bash: !: event not found" and doesn't even execute the command. If I use single quotes around the filter like this: ldapsearch '(&(cn=$LOGIN)(!(usertype=student)))' the command runs but the variable does not get expaned. If I use a backslash escape like this: ldapsearch "(&(cn=$LOGIN(\!(usertype=student)))" ldapsearch complains about "ldapsearch: ldap_search_ext: Bad search filter (-7)" Any ideas? Jason Joines =================================