Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Fun bash script to write to XAMPP vhost and add symbolic link.
# Format of command: ./ projectDir path/to/project/Dir
# Number of expected arguments
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
if [ $# -ne $EXPECTED_ARGS ]; then
echo "Inputed wrong number of arguments"
#Create symbolic link with second folder param
create_symbolic_link $3 $2
#Modify vhost file with given url
modify_vhosts $1 $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment