#!/bin/bash

# List of directories to create
directories=(
    "allied-ug"
    "bds"
    "allied-pg"
)

# Base path where directories will be created
base_path="/var/www/html/mangalore/"

# Sample content for index.html
html_content="""
<!DOCTYPE html>
<html>
<head>
    <title>Sample Page</title>
</head>
<body>
    <h1>Welcome to the directory</h1>
    <p>This is a sample index.html file.</p>
</body>
</html>
"""

# Create directories and index.html files
for dir in "${directories[@]}"; do
    dir_path="$base_path/$dir"
    
    # Create the directory if it doesn't exist
    if [ ! -d "$dir_path" ]; then
        mkdir -p "$dir_path"
        echo "Directory created: $dir_path"
    else
        echo "Directory already exists: $dir_path"
    fi

    # Create the index.html file with the specified content
    echo "$html_content" > "$dir_path/index.html"
    echo "index.html created in: $dir_path"
done

echo "All directories and index.html files have been created."
