language_chooser.sh 478 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. #languages="C++
  3. #Python
  4. #TypeScript
  5. #C
  6. #Go
  7. #Ruby
  8. #PHP
  9. #Racket"
  10. #
  11. #echo "$languages" | shuf | head -n5
  12. lang_frek="$(find . -maxdepth 1 -mindepth 1 -not -path './.git' -type d \
  13. | parallel -j1 'find {} -maxdepth 1 -mindepth 1 -type f | wc -l | xargs echo {}' \
  14. | sort -k2)"
  15. lest_amount="$(echo "$lang_frek" | head -n1 | cut -d' ' -f2)"
  16. possibles="$(echo "$lang_frek" | grep "$lest_amount" | sed "s/ ${lest_amount}//g")"
  17. echo "$possibles" | shuf | head -n5