From owner-freebsd-questions@FreeBSD.ORG Wed Jul 27 22:14:48 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BF6A016A41F for ; Wed, 27 Jul 2005 22:14:48 +0000 (GMT) (envelope-from martin@orbweavers.co.uk) Received: from mail.orbweavers.co.uk (213-152-38-100.dsl.eclipse.net.uk [213.152.38.100]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4BDDA43D45 for ; Wed, 27 Jul 2005 22:14:47 +0000 (GMT) (envelope-from martin@orbweavers.co.uk) Received: from 192.168.0.5 (localhost.orbweavers.co.uk [127.0.0.1]) by mail.orbweavers.co.uk (Postfix) with ESMTP id 72AD8B2434 for ; Wed, 27 Jul 2005 23:14:46 +0100 (BST) Received: from 192.168.0.10 (SquirrelMail authenticated user martin) by 192.168.0.5 with HTTP; Wed, 27 Jul 2005 23:14:46 +0100 (BST) Message-ID: <1559.192.168.0.10.1122502486.squirrel@192.168.0.5> Date: Wed, 27 Jul 2005 23:14:46 +0100 (BST) From: martin@orbweavers.co.uk To: freebsd-questions@freebsd.org User-Agent: SquirrelMail/1.4.4 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Shell script frustration X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2005 22:14:48 -0000 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