Script the creation of vhosts in Apache

Scripting is your lifesaver as a sysadmin, it gives you time for other things, such as the beach, bike, whatever. We are going to take a quick look creating Apache virtual hosts from a bash shell script. The main “meat and veg” of the script uses sed to parse the vhost template. Quick and easy to use and better than typing. Once the Linux BASH script is created then we can run the script and just specify, as an argument, the name of the virtual host to create in Apache. What could be more simple?