Linux quick and dirty bash visualiser

Hi guys. If you’re using Linux, here’s a quick and dirty bash visualizer. Paste this script into a .sh file and give it the output directory (the one with the “Phase x - Round y” directories in it as parameter. It will then visualize the process in a very unspectacular fashion. I find it sufficient, so maybe it can help someone else.

If you can solve the spacing issue with the “pr” command - please let me know. I could not quite get that part right, without trying my hand with sed and awk and I didn’t have the energy for that.

#!/bin/bash

function visualise {
  pr -w 80 -m -t "$1"/A\ -\ map.txt "$1"/B\ -\ map.txt
  read -t1 -n1 -r
}

if [ $# -ne 1 ]; then
  echo "Synopsis: $0 <dir>"
  echo The directory is the directory as downloaded from player portal
  echo and extracted.
  exit 1
fi

cd $1

count=0
dir="Phase 1 - Round $count"
while [ -d "$dir" ]; 
do
  echo $dir
  visualise "$dir"
  count=$((count+1))
  dir="Phase 1 - Round $count"
done
    
dir="Phase 2 - Round $count"
echo $dir
while [ -d "$dir" ]; 
do
  echo $dir
  visualise "$dir"
  count=$((count+1))
  dir="Phase 2 - Round $count"
done
1 Like