Created
June 16, 2014 21:00
-
-
Save dflynn15/e4743e6d7ce360cd3fa6 to your computer and use it in GitHub Desktop.
Fun bash script to write to XAMPP vhost and add symbolic link.
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 | |
# Format of command: ./xampp.sh new.website.name.com projectDir path/to/project/Dir | |
# Number of expected arguments | |
EXPECTED_ARGS=3 | |
function create_symbolic_link { | |
sudo ln -s $1 /Applications/XAMPP/xamppfiles/htdocs/$2 | |
} | |
function modify_vhosts { | |
sudo printf "\n<VirtualHost *:80 *:3002>\n\tDocumentRoot \"/Applications/XAMPP/xamppfiles/htdocs/$2\" \n\tServerName $1 \n</VirtualHost>" >> /Applications/XAMPP/etc/extra/httpd-vhosts.conf | |
} | |
clear | |
if [ $# -ne $EXPECTED_ARGS ]; then | |
echo "Inputed wrong number of arguments" | |
else | |
#Create symbolic link with second folder param | |
create_symbolic_link $3 $2 | |
#Modify vhost file with given url | |
modify_vhosts $1 $2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment