Created
April 11, 2019 13:24
-
-
Save boardstretcher/906568cb395e13285bf802d18cf03acc 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 | |
function one () { | |
echo 'RUN: function 1' | |
} | |
function two () { | |
echo 'RUN: function 2' | |
} | |
function three () { | |
echo 'RUN: function 3' | |
} | |
DOMAIN=$(hostname -d) | |
if [ -z "$DOMAIN" ] | |
then | |
echo "ERROR: domain variable is null" | |
exit 1 | |
fi | |
if [[ $HOSTNAME =~ .*01$ ]]; then HOSTCAT=1; fi | |
if [[ $HOSTNAME =~ .*02$ ]]; then HOSTCAT=2; fi | |
if [[ $HOSTNAME =~ .*03$ ]]; then HOSTCAT=3; fi | |
case $HOSTCAT in | |
1) one;; | |
2) two;; | |
3) three;; | |
*) echo "UNKNOWN CASE" && exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment