https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbJvSU_r5dFW7LjA3KCme9lLIM-cpfxvk_NpYhnlEdqMStCV4RWbicE4s46ym1BF9AMWPm8ocOqo6jho32yo7VChlZ3Z9gVOsDgIUVI694RX_eeIGkcGNO0k6mDikwanoJJOH6z9mkFEo/s640/wave.bash.gif

Back in 2013, I started “CodeSth” and had a thought about drawing an ASCII tidal wave, here is a code I just wrapped up quick for fun:


#!/bin/bash

WIDTH=$(tput cols)

w='.)`-,.'
printf -v sep '%*s' $((WIDTH - ${#w}))
w="$w${sep// /_}"

while sleep .05; do
echo "${w:x}${w:0:x}"
((x = (x + 1) % ${#w}))
done

There is nothing special about it, it just paints the wave with a separator line and my not-so-artistic ASCII sense. Basically, it cycles through by characters, print by each iteration. In the output, it looks as if you are looking at the ocean at an angle or 30 degrees or 60 degrees.

Now, dim the light, play soothing music, light up a scented candle, yeah, right, like I really do that. But if you want to do so, my lips are sealed.