包含ldapmodify的shell脚本 - 硬编码命令

She*_*rSt 5 linux shell ldap active-directory

我正在尝试在shell脚本中运行ldapmodify命令,但我不想指定包含命令的外部文件(-f标志).这只是为了方便 - 外部文件中的命令是动态的,因此每次shell脚本运行ldapmodify时避免编写新文件会很好.我希望脚本基本上在命令行中输入以下内容:

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)
Run Code Online (Sandbox Code Playgroud)

谁知道怎么做?

Ter*_*ner 11

使用"此处"文档:

ldapmodify .. <<!
dn: dc=example,dc=com
changetype: modify
replace: description
 -
add: description
description: The new description
!
Run Code Online (Sandbox Code Playgroud)

例如.