Last active
August 29, 2015 14:07
-
-
Save lloydwatkin/1d6c9e3e19a2fa707a0b to your computer and use it in GitHub Desktop.
Split arguments up for vhost substitution
This file contains 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 | |
# | |
# - For example: | |
# | |
# VHOSTS="xmpp.surevine.com|locahost:3000|websocket;stats.surevine.com|localhost:8080" ./splitter.sh | |
# | |
VHOST_SEPARATOR=";" | |
PARAM_SEPARATOR="|" | |
echo "Processing: $VHOSTS" | |
vhosts=$(echo $VHOSTS | tr $VHOST_SEPARATOR "\n") | |
for vhost in $vhosts | |
do | |
IFS="$PARAM_SEPARATOR" read -a params <<< "$vhost" | |
domain="${params[0]}" | |
proxy="${params[1]}" | |
conf="${params[2]}" | |
if [ -z "$conf" ]; then | |
conf="default" | |
fi | |
echo -e "\n$domain \n======================\n\ | |
Proxy :\t $proxy\n\ | |
Conf :\t $conf" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment