Skip to content

Instantly share code, notes, and snippets.

@otype
Created June 19, 2012 22:31
Show Gist options
  • Save otype/2956905 to your computer and use it in GitHub Desktop.
Save otype/2956905 to your computer and use it in GitHub Desktop.
Christmas Tree in zsh
#!/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