Skip to content

Instantly share code, notes, and snippets.

@paxperscientiam
Last active June 22, 2018 03:56
Show Gist options
  • Save paxperscientiam/4040dcdac11ebd480c347386439fc038 to your computer and use it in GitHub Desktop.
Save paxperscientiam/4040dcdac11ebd480c347386439fc038 to your computer and use it in GitHub Desktop.
Neatly list Apache virtual hosts
APACHECTL='/path/to/apachectl'
HTTPD_CONFIG='/path/to/httpd.conf'
printf '%s\n' "Server alias list:"
while IFS='' read -r line; do
if [[ $line =~ alias*(.+) ]]; then
printf '%s\n' "${BASH_REMATCH[1]}"
fi
done < <("${APACHECTL}" -f "${HTTPD_CONFIG}" -S)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment