-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jim C wrote on Tue, Jan 14, 2003 at 11:31:20AM -0800 :
> I finally got around to giving your suggestion a try. :-)
> 
> cat > $newldif <<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
> 
> echo $newldif
> 
> This produces:
> 
> [root@enigma scripts]# ./adduser adlfalj
> ./adduser: line 42: $newldif: ambiguous redirect

You've got something else going on cause it works on mine.  (Are you
sure that you're using the bash shell?)

[todd@fiji ~/tmp]$ cat file1
#!/bin/bash
#
newldif="./file2"
#
cat > $newldif <<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
#
cat $newldif

[todd@fiji ~/tmp]$ ./file1 todd
dn: uid=todd,ou=Computers,dc=microverse,dc=net
objectClass: top
objectClass: account
objectClass: posixAccount
uidNumber: 
uid: todd
cn: todd
gidNumber: 
homeDirectory: /dev/null
loginShell: /bin/false
gecos: Machine Account
description: Machine Account

> This causes the script to halt at some point and gives no output if you 
> replace the 'cat' with 'echo'.

Sounds like
1) You've got a misplaced backtick.
2) You're using different delimiters for the << hrdoc start point and
hrdoc endpoint.

Post the WHOLE script so we can see what you're doing.  If you change
anything make sure you say exactly what you change.

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

What I said originally should still work.

Blue skies...                   Todd
- -- 
           MandrakeSoft USA   http://www.mandrakesoft.com
          cat /boot/vmlinuz > /dev/dsp  #for great justice
   Cooker Version mandrake-release-9.1-0.1mdk Kernel 2.4.20-2mdk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+JLl8lp7v05cW2woRAuSQAKDOd7bKbEgO3kt6eL8SLrZHLcwwHACcCSWk
r7X2YShaye9fOJwX7rcsyWQ=
=559n
-----END PGP SIGNATURE-----

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to