Created
September 7, 2016 18:46
-
-
Save Miciah/c453518dc41eca35b0d058707bc908b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
declare -a uids_ary=( ${1//,/ } ) | |
printf -v uids_list '(uid=%s)' "${uids_ary[@]}" | |
shift | |
declare -a criteria=( "(|$uids_list)" ) | |
while [[ "${1-}" = *=* ]] | |
do | |
criteria+=( "$1" ) | |
shift | |
done | |
ldapsearch -x -h ldap.corp.redhat.com -b 'ou=users,dc=redhat,dc=com' \ | |
"${criteria[*]}" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment