list_levels.sh 627 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. # Lists all level numbers with their planet id and planet name.
  3. # First argument should be the path to your Jazz directory (where level0.000
  4. # etc are).
  5. if [[ "${1}" == "" ]]; then
  6. echo "Please give the path to your Jazz directory as first argument."
  7. exit 1
  8. fi
  9. (
  10. for file in ${1}/level*; do
  11. filename="$(basename ${file})"
  12. x="${filename##level}"
  13. x=(${x//./ })
  14. level="${x[0]}"
  15. planet="${x[1]}"
  16. planetfile="planet.${planet}"
  17. planetname=$(head -c19 ${1}/"${planetfile}" | tail -c16 | strings)
  18. echo "${planet} ${level} ${planetname} level $(( ${level} + 1 ))"
  19. done
  20. ) | sort