Shell script frustration

martin at martin at
Wed Jul 27 22:14:48 GMT 2005


   I am making big progress in writing the ldap tools I mentioned earlier,
but I have come across a completly frustrating problem I can't crack.
Most likely it is something simple to do with the shell scripting, but
I can't figure it out at all - script is

binddn=`awk '/rootdn/ {print $2}' /usr/local/etc/openldap/slapd.conf`
group_base=`awk '/nss_base_group/ {print $2}' /etc/ldap.conf | cut -f1 -d?`

echo ldapdelete -W -D $binddn \"cn=$1, $group_base\"
ldapdelete -W -D $binddn \"cn=$1, $group_base\"

It grabs the rootdn from the slapd.conf file, then the base ou for the
groups from the ldap.conf file, and construct the delete statement from

when run ('./rmgroup users') it outputs -

ldapdelete -W -D "cn=Manager,dc=orbweavers,dc=co,dc=uk" "cn=users,
Enter LDAP Password:
ldap_bind: Invalid DN syntax (34)
        additional info: invalid DN

However, if I copy and paste the echod statement (the first line of the
output) straight to the shell, it run fine.  I've tried every which way of
quoting I can think of, but nothing gives. Please tell me I am missing
something really obvious and I can retrieve my sanity!


More information about the freebsd-questions mailing list