I'm trying to run an ldapmodify command in a shell script, but I don't want to specify an external file containing commands (-f flag). This would just be for convenience - the commands in the external file would be dynamic, so it would be nice to avoid writing a new file every time the shell script ran ldapmodify. I would want the script to essentially enter the following into the command line:
prompt/> ldapmodify -v -H LDAP://111.111.111.11 -D "CN=binding_user,DC=example,DC=com" -x -w password
> dn: CN=group_name, OU=Groups, DC=example, DC=com
> changetype: modify
> add: member
> member: CN=Smith\, John, OU=Users, DC=example, DC=com
> (user presses Ctrl-D)
Anyone know of how to do this?
Use a "here" document:
ldapmodify .. <<!
dn: dc=example,dc=com
changetype: modify
replace: description
-
add: description
description: The new description
!
For example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With