yes $COLUMNS $LINES|awk 'BEGIN{x=y=e=f=1}{if(x==$1||!x){e*=-1};if(y==$2||!y){f*=-1};x+=e;y+=f;printf "\033[%s;%sH",y,x;for (a=0;a<400000;a++){}}' # Make your cursor bounce around the terminal. The 400000 in the for loop is just a busy delay. Adjust as needed.

Follow

man bash | sed 's/./&\n/g' | awk -v mx=$COLUMNS -v my=$LINES 'BEGIN{x=y=e=f=1}{if(x==mx||!x){e*=-1};if(y==my||!y){f*=-1};x+=e;y+=f;printf "\033[%s;%sH%s",y,x,$1;for (a=0;a<400000;a++){}}' # Print the bash man page in diagonal lines across the screen.

@climagic this reminds me of the shit i'd write in qbasic when i was a kid

@velartrill
Lol, me too, that was my first actual functional QBasic program - bouncy asterisk "screensaver"

@climagic All I see is elder script bleeding into our world.

@climagic this is the most useful piece of code I've ever seen in my life.

@climagic If you have a 128x32 terminal window it will only draw a "W" pattern. :D

@climagic
A version that accepts any output:

#!/bin/bash

ARGS=$@;
LINES=$(tput lines)
COLUMNS=$(tput cols)
if [ $# -eq 0 ]; then ARGS='man bash'; fi
bash -c "$ARGS" | sed 's/./&\n/g' | awk -v mx=$COLUMNS -v my=$LINES 'BEGIN{x=y=e=f=1}{if(x==mx||!x){e*=-1};if(y==my||!y){f*=-1};x+=e;y+=f;printf "\033[%s;%sH%s",y,x,$1;for (a=0;a<400000;a++){}}'

@k @climagic line returns are a lot tricker in openbsd sed and awk wants a fflush().

and use a real man page :)

Try this version.

man pf.conf | sed 's/./&\
/g' | awk -v mx=$COLUMNS -v my=$LINES 'BEGIN{x=y=e=f=1}{if(x==mx||!x){e*=-1};if(y==my||!y){f*=-1};x+=e;y+=f;printf "\033[%s;%sH%s",y,x,$1;fflush();for (a=0;a<400000;a++){}}'

@climagic Please don't loose your time with `cat`, it's addictive!

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!