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
Friday, August 2, 2013
1 comments:
graeat
Post a Comment