0
我有bash的腳本:如何解決分詞
for i i in `ldapsearch -xZZLLLD cn=admin,dc=example,dc=com -w -b dc=example,dc=com '(&(objectclass=inetOrgPerson)(memberOf=cn='$groups',ou=Groups,dc=example,dc=com))' dn`
do
echo $i
done
輸出:
dn:
uid=user1,ou=People,dc=example,dc=com
dn:
uid=user2,ou=People,dc=example,dc=com
麻煩的是,輸出不正確。我讀到了「分詞」,但不明白如何解決這個問題。我需要得到:
dn: uid=user1,ou=People,dc=example,dc=com
dn: uid=user2,ou=People,dc=example,dc=com
輸出命令:
ldapsearch -xZZLLLD cn=admin,dc=example,dc=com -w -b dc=example,dc=com '(&(objectclass=inetOrgPerson)(memberOf=cn='$groups',ou=Groups,dc=example,dc=com))' dn
dn: uid=user,ou=People,dc=example,dc=com
dn: uid=user1,ou=People,dc=example,dc=com
dn: uid=user2,ou=People,dc=example,dc=com
請告訴我'ldapsearch的-xZZLLLD CN =管理員,DC =例如,DC = COM -w -b DC =實施例的輸出, dc = com'(&(objectclass = inetOrgPerson)(memberOf = cn ='$ groups',ou = Groups,dc = example,dc = com))'dn'? – heemayl
@heemayl dn:uid = user,ou = People,dc = example,dc = com – Nikita
請編輯您的問題並添加它。 – heemayl