Printing pattern in bash with N number of rows

Anju
Apr 1, 2021

--

#!/bin/bash
read -p "Enter how many rows you want to print:" rows
for((i=1; i<=rows; i++))
do
for((j=1; j<=i; j++))
do
echo -n "*"
done
echo
done

--

--

Anju
Anju

Written by Anju

A DevOps engineer who loves automating everything (almost), exploring new places, and finding peace in nature. Always looking for the next adventure!

No responses yet