Friday, August 2, 2013
11:12 PM

Shell Script to print pyramid of Stars

Q. How do I print pyramid of stars using function in Bash
Ans.

Before writing bash script lets understand how we going to print this pattern. We do it in two part, first we are going to print part 1 and then we print the part 2.

#!/bin/bash
makePyramid()
{
#Here $1 is the parameter you passed with the function i,e 5
n=$1;

#outer loop is for printing number of rows in the pyramid
for((i

1 comments:

Anonymous said...

graeat

Post a Comment