--- /dev/null
+#!/bin/bash
+
+set -e
+set -u
+
+BASE_NAME="$( basename ${0} )"
+MY_REAL_NAME=$( readlink -f $0 )
+BIN_DIR=$( dirname "${MY_REAL_NAME}" )
+BASE_DIR=$( dirname "${BIN_DIR}" )
+LIB_DIR="${BASE_DIR}/lib"
+CONF_DIR="${BASE_DIR}/etc"
+
+if [[ -f "${LIB_DIR}/functions.rc" ]] ; then
+ . "${LIB_DIR}/functions.rc"
+else
+ echo "Bash resource file '${LIB_DIR}/functions.rc' not found" >&2
+ exit 5
+fi
+
+declare -a SEARCH_IDS=()
+
+detect_color
+
+DESCRIPTION=$( cat <<-EOF
+ Get all LDAP groups, where the user with the given DN uid or mail address is a member of.
+
+ EOF
+)
+
+#------------------------------------------------------------------------------
+get_options() {
+
+ local tmp=
+ local base_dir=
+
+ set +e
+ tmp=$( getopt -o ${LDAP_STD_OPTS_SHORT}${STD_SHORT_OPTIONS} \
+ --long ${LDAP_STD_OPTS_LONG},${STD_LONG_OPTIONS} \
+ -n "${BASE_NAME}" -- "$@" )
+ if [[ $? != 0 ]] ; then
+ echo "" >&2
+ usage >&2
+ exit 1
+ fi
+ set -e
+
+ # Note the quotes around `$TEMP': they are essential!
+ eval set -- "${tmp}"
+ eval_common_options "$@"
+ if [[ "${DEBUG}" == 'y' ]] ; then
+ declare -p REMAINING_OPTS
+ declare -p REMAINING_ARGS
+ fi
+
+ eval_ldap_options "${REMAINING_OPTS[@]}" "${REMAINING_ARGS[@]}"
+
+ if [[ "${DEBUG}" == 'y' ]] ; then
+ declare -p REMAINING_OPTS
+ declare -p REMAINING_ARGS
+ fi
+
+ if [[ "${#REMAINING_OPTS[@]}" -gt 0 ]] ; then
+ error "Unknown options: ${REMAINING_OPTS[*]}"
+ echo >&2
+ usage >&2
+ exit 2
+ fi
+
+ if [[ "${#REMAINING_ARGS[@]}" == "0" ]] ; then
+ error "No user given to retrieve."
+ echo >&2
+ usage >&2
+ exit 2
+ fi
+
+ local i=0
+ local token=
+ for token in "${REMAINING_ARGS[@]}" ; do
+ if [[ "$i" == 0 ]]; then
+ i=1
+ continue
+ fi
+ SEARCH_IDS+=(${token})
+ i=$(( $i + 1 ))
+ done
+
+ if [[ "${DEBUG}" == 'y' ]] ; then
+ declare -p SEARCH_IDS
+ fi
+
+}
+
+#------------------------------------------------------------------------------
+usage() {
+ cat <<-EOF
+ Usage: ${BASE_NAME} [Common Options] [LDAP Options] <ID> [<ID> ...]
+ ${BASE_NAME} [-h|--help]
+ ${BASE_NAME} [-V|--version]
+
+ Mandatory Parameter(s):
+ ID: The DN, UID or mail address of the user to search.
+
+ LDAP Options:
+ EOF
+
+ echo "${LDAP_USAGE_MSG}"
+ echo
+ echo " Common Options:"
+ echo "${STD_USAGE_MSG}"
+
+}
+
+#------------------------------------------------------------------------------
+main() {
+
+ get_options "$@"
+
+
+}
+
+main "$@"
+
+exit 0
+
+# vim: et list