ldapscripts do not work from inside a "while read line" loop.
The exact same scripts were working fine until the last upgrade
Repeat-By:
Prerequisite: ldapscripts installed.
Open a new bash script and type in the following:
-------------------------------------------------
#!/bin/bash
echo "Testing if it works outside of the loop"
ldapid
echo "Getting into the read line loop"
while read line
do
ldapid
done <"Some file"
------------------------------------------------
The 'ldapid' command, which works outside of the loop, does not work
from within. This time it throws an error "Cannot guess user". Now we
check an alternative:
Create a new script and type in the following:
------------------------------------------------
#!/bin/bash
echo "Testing if it works outside of the loop"
ldapid
readarray lines < "some file"
echo "Getting into the for loop"
for line in "${lines[@]}"
do
ldapid
done
-----------------------------------------------
In this case 'ldapid' works both times. In fact, ldapid works in every
other loop except a 'while read line' and I really do not have any idea why.