Created
June 19, 2012 22:31
-
-
Save otype/2956905 to your computer and use it in GitHub Desktop.
Christmas Tree in zsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Creating a nice christmas tree in zsh | |
# | |
# 1. Save this file as christmas.zsh | |
# 2. $ chmod +x christmas.zsh | |
# 3. ./christmas.zsh 10 | |
# | |
COUNT=$1 | |
let num_stars=1 | |
let half="$COUNT" | |
for i in `seq 1 $COUNT` | |
do | |
spaces="" | |
for left in `seq 1 $half`; do spaces="$spaces " done | |
stars="" | |
for j in `seq 1 $num_stars`; do stars="${stars}*" done | |
echo "${spaces}${stars}" | |
let half="$half - 1" | |
let num_stars="${num_stars} + 2" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment