#! /bin/bash
ldapurl="ldap://ad.local.lan:389"
basedn="OU=some,DC=local,DC=lan"
binddn="CN=someuser,OU=piter,DC=local,DC=lan"
ldappas="somepass"
ldapsrc="ldapsearch -LLL -H \"$ldapurl\" -b \"$basedn\" -D \"$binddn\" -w \"$ldappas\""
$ldapsrc
Could not parse LDAP URI(s)="ldap://ad.local.lan:389" (3)
echo $ldapsrc