I trying to make a program that outputs a triangle of stars in Bash.
Here is what it would look like:
However, I am getting:
line 8: [: 1: unary operator expected error
Here is my code
#! /bin/bash
read -p "Please input a number for a magical surprise diagram: " input
tri1="1"
tri2="1"
while [ $tri1 -le $input ]; do
while [ $tri2 -le $tri1 ]; do
echo -n "*"
tri2=$( ( $tri2 + 1 ) )
done
echo -n ""
tri1=$( ( $tri1 + 1 ) )
tri2=1
done
I am a beginner at Bash scripting, so please bear with me as I learn.