Answer the question
In order to leave comments, you need to log in
Why is ldapsearch so weird?
#! /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
Answer the question
In order to leave comments, you need to log in
You don't use spaces in any of your variables, so you don't need the inner quotes.
ldapsrc="ldapsearch -LLL -H $ldapurl -b $basedn -D $binddn -w $ldappas"
$ldapsrc
Try single quotes
ldapsrc='ldapsearch -LLL -H \"$ldapurl\" -b \"$basedn\" -D \"$binddn\" -w \"$ldappas\"'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question