Skip to content

Instantly share code, notes, and snippets.

@fusion809
Created February 8, 2026 12:15
Show Gist options
  • Select an option

  • Save fusion809/04e7606fce685d88a7eeb2a316f38aa0 to your computer and use it in GitHub Desktop.

Select an option

Save fusion809/04e7606fce685d88a7eeb2a316f38aa0 to your computer and use it in GitHub Desktop.
Generalized script for displaying the percentage of commands provided by each stratum under Bedrock.
commlist=$(compgen -c | sort -u | xargs -n 100 brl which 2>/dev/null)
nocomm=$(echo $commlist | tr ' ' '\n' | wc -l)
function Rcalc {
out=$(R -q -e "$1")
echo "$out" | head -n 2 | tail -n 1 | sed -E 's/^\[1\]\s//g'
}
stratList=$(brl list | grep -v bedrock; echo global;)
stratList=$(echo $stratList | tr ' ' '\n' | sort -u)
echo $stratList | tr ' ' '\n' | while read -r s; do
no=$(echo $commlist | tr ' ' '\n' | grep $s | wc -l)
perc=$(Rcalc "100*$no/$nocomm")
echo "${s^} provides $perc% of commands"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment