-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jim C wrote on Mon, Jan 13, 2003 at 10:16:41AM -0800 :
>
> What I am trying to do is create a sort of virtual file.
> I've already tried using the here document and it doesn't seem to be
> working for me. What I am trying to do exactly is create an LDIF file
> for passing to an LDAP database. I have each line stored in an
> individual shell variable like so:
There are two ways to do this:
1) Create an ldif file, then call ldap* with that ldif file.
2) Just pass it all to ldap* on stdin.
> The syntax I've been trying looks like this:
> ldapadd -x -D $binddn -w "placepasswordhere" <<hrdoc
> line1="dn: uid=$1,ou=Computers,dc=microverse,dc=net";
> line2="objectClass: top"
<snip>
Look at this:
#!/bin/bash
cat > $1.ldif <<hrdoc
dn: uid=$1,ou=Computers,dc=microverse,dc=net
objectClass: top
objectClass: account
objectClass: posixAccount
uidNumber: $store
uid: $1
cn: $1
gidNumber: $groupnum
homeDirectory: /dev/null
loginShell: /bin/false
gecos: Machine Account
description: Machine Account
hrdoc
Then you just do 'ldapadd -x -f $1.ldif blah blah blah'
> In all cases the here document doesn't seem to make it to the ldapadd
> command which I know reads from standard-in.
All you gotta do is change the "command" portion of the above that I
quoted:
#!/bin/bash
ldapadd -x blah blah blah <<hrdoc
dn: uid=$1,ou=Computers,dc=microverse,dc=net
objectClass: top
objectClass: account
objectClass: posixAccount
uidNumber: $store
uid: $1
cn: $1
gidNumber: $groupnum
homeDirectory: /dev/null
loginShell: /bin/false
gecos: Machine Account
description: Machine Account
hrdoc
Blue skies... Todd
- --
MandrakeSoft USA http://www.mandrakesoft.com
Mandrake: An amalgam of good ideas from RedHat, Debian, and MandrakeSoft.
All in all, IMHO, an unbeatable combination. --Levi Ramsey on Cooker ML
Cooker Version mandrake-release-9.1-0.1mdk Kernel 2.4.20-2mdk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+Iy/Ylp7v05cW2woRAhwMAJoDELaI+O82WNuz5SRnujaXG5y7hQCfUdlY
dCj3ZneaqniZkaaADmAFVD4=
=O07o
-----END PGP SIGNATURE-----
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com