ldapsearch allow you to specify password file with option -y. However, there is one condition for this password file is it cannot contain newline. To make sure you create a password file without newline, use echo -n where -n allow you to output without trailing newline. Example:
echo -n 'password' > .passFile