Added choinka.sh script

This commit is contained in:
Arkadiusz Hypki 2023-04-24 16:25:47 +02:00
commit d36025414a

65
choinka.sh Executable file
View File

@ -0,0 +1,65 @@
echo ""
before=6
after=0
leaf=0
# go over all rows of the tree
for ((j=1;j<=25;j++))
do
# drawing what is before the leaf
for ((c=1;c<=before;c++))
do
echo -n " "
done
# draw the leaf
echo -n "*"
# draw what is after the leaf, but before the trunk
for ((c=1;c<=after;c++))
do
echo -n " "
done
# draw trunk
echo -n "##"
# AND everything reversed
for ((c=1;c<=after;c++))
do
echo -n " "
done
echo -n "*"
for ((c=1;c<=before;c++))
do
echo -n " "
done
# going to the next row
echo ""
((before=before-1))
((after=after+1))
if [ $before -eq -1 ]
then
# drawing the end of one branch
echo "*******##*******"
before=6
after=0
((leaf=leaf+1))
if [ $leaf -eq 3 ]
then
# drawing the end of the tree - just the trunk
for ((c=1;c<=3;c++))
do
echo " ## "
done
exit
fi
fi
done
echo ""