I have a simple ldapsearch bash script to return the user email when searched by ID. I made it take and argument as its input since at the time I only needed to run it once or twice.
I'm wondering can I adapt it and take input from a file like .txt and append the outputs to another file.
This is what i have:
#!/bin/bash
if [ "$1" = "" ]; then
echo "how to: searchID.sh <userID>"
exit 1
fi
ldapsearch -x -b '' -LLL -h ldaphost.com -p 255 uid=$1 mail >> outputs.txt
Instead of running it manually like:
./searchID.sh I0FT45
I want it to take input from a file with many ID's like:
I0001F
IGLFK7
I37462
I4593N
And run it for all those entries. Any help is very much appreciated