Draw Animated Christmas Tree In Bash


It’s Christmas again and you’ll be receiving all kinds of greetings. How about greeting them back with a fancy way ? Show off your nerdiness with this super cool Christmas Tree in Bash.

All you need is a Linux/Unix terminal with bash installed. Most systems come with bash. So, you don’t have to install anything for this !

Here’s how it looks :

Christmas Tree in Bash

Christmas Tree in Bash

First of all open a terminal and copy this script to your computer :

wget -d -c -O "christmas.sh" "<a href="https://raw.githubusercontent.com/sergiolepore/ChristBASHTree/master/tree-EN.sh">https://raw.githubusercontent.com/sergiolepore/ChristBASHTree/master/tree-EN.sh/blob/master/tree-EN.sh</a>"

Make the file executable :

chmod a+x ./christmas.sh

RUN !

./christmas.sh

Ain’t that fancy ? All thanks goes to the Argentian programmer Sergio Lepore for this cool trick.

Fork

You can make your own little changes in the script to add your name and other stuff. I added my name using this line :

tput cup $((lin + 3)) $((c - 4)); echo subins2000

I added the above line just after “And lots of CODE in $new_year” line.

You can do anything with this script. Maybe translate it your own language or add more fancy stuff. Let me know what you have done 🙂

Make A Gif

Let’s make a gif of this great terminal gift. You can use this gif to send to your friends or post on social networks.

We’ll use a screen recorder and a gif converter. For this, install these :

sudo apt install gtk-recordmydesktop ffmpeg winff

Use gtk-recordmydesktop to record the terminal. This will output a OGV file. Then do the following 2 commands to make the gif :

ffmpeg -y -i input.ogv -vf fps=10,scale=800:-1:flags=lanczos,palettegen palette.png
ffmpeg -i input.ogv -i palette.png -filter_complex "fps=10,scale=800:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif

If you want to trim the video, you can add the following options :

-ss 30 -t 3

which stands for “start from 3rd second and duration 30 seconds.