Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jul 2005 23:14:46 +0100 (BST)
From:      martin@orbweavers.co.uk
To:        freebsd-questions@freebsd.org
Subject:   Shell script frustration
Message-ID:  <1559.192.168.0.10.1122502486.squirrel@192.168.0.5>

next in thread | raw e-mail | index | archive | help

Hi,

   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
that.


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

ldapdelete -W -D "cn=Manager,dc=orbweavers,dc=co,dc=uk" "cn=users,
ou=groups,dc=orbweavers,dc=co,dc=uk"
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!

cheers,
Martin





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1559.192.168.0.10.1122502486.squirrel>