vendredi 27 juillet 2018

Script to pick random directory in bash

I have a directory full of directories containing exam subjects I would like to work on randomly to simulate the real exam.

They are classified by difficulty level:

0-0, 0-1 .. 1-0, 1-1 .. 2-0, 2-1 ..

I am trying to write a shell script allowing me to pick one subject (directory) randomly based on the parameter I pass when executing the script (0, 1, 2 ..).

I can't quite figure it, here is my progress so far:

ls | find . -name "1$~" | sort -r | head -n 1

What am I missing here?




Aucun commentaire:

Enregistrer un commentaire