#!/bin/bash

read -p "Enter the number of rows for the pyramid: " rows
rows=4
# Loop to iterate through each row
for ((i = 1; i <= rows; i++)); do
    # Loop to print spaces
    for ((j = i; j <= rows; j++)); do
        echo -n " "
    done

    # Loop to print stars
    for ((k = 1; k <= 2 * i - 1; k++)); do
        echo -n "*"
    done

    echo "" # Move to the next line
done

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: