Shell script frustration

Garance A Drosihn drosih at rpi.edu
Thu Jul 28 00:34:16 GMT 2005


At 11:14 PM +0100 7/27/05, martin at orbweavers.co.uk wrote:
>
>echo ldapdelete -W -D $binddn \"cn=$1, $group_base\"
>ldapdelete -W -D $binddn \"cn=$1, $group_base\"


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

What I do in this cases is create a script called "list_args.sh":

#!/bin/sh
printf "\nlist_args.sh at `date +%H:%M:%S` with \$# = $#\n"
# Process all parameters.
N=0
while test $# != 0 ; do
     N=$(($N+1))
     printf "    \$$N = [%3d] '$1'\n" ${#1}
     shift
done

Then in your script, replace the ldapdelete command with
list_args.sh.  That way you'll see *exactly* what ldapdelete
is seeing for parameters, and that might help.

-- 
Garance Alistair Drosehn            =   gad at gilead.netel.rpi.edu
Senior Systems Programmer           or  gad at freebsd.org
Rensselaer Polytechnic Institute    or  drosih at rpi.edu


More information about the freebsd-questions mailing list