24 lines
642 B
Bash
Executable file
24 lines
642 B
Bash
Executable file
#!/bin/bash
|
|
|
|
regex=${1}
|
|
domains_regex=$(yq -r '.domains_regex' ${HOME}/.config/sunet/config.yaml 2>/dev/null)
|
|
|
|
if [[ -z ${regex} ]]; then
|
|
regex='.*'
|
|
fi
|
|
|
|
if [[ -z ${domains_regex} ]] || [[ ${domains_regex} == 'null' ]]; then
|
|
domains_regex='sunet.se|sunet.dev|eduid.se|swamid.se'
|
|
fi
|
|
|
|
readarray -t directories < <(yq -r '.ops_repos[]' ${HOME}/.config/sunet/config.yaml 2>/dev/null)
|
|
if [[ -z ${directories} ]]; then
|
|
echo "No ops repos found in ${HOME}/.config/sunet/config.yaml"
|
|
exit 1
|
|
fi
|
|
for directory in "${directories[@]}"; do
|
|
servers="$(ls "${directory}"|grep -E "${domains_regex}")"
|
|
echo "${servers}" | grep -E "${regex}"
|
|
done
|
|
|