Open fedordikarev opened 7 months ago
What about this:
# Check for submission folder inconsistencies
last_folder_num="$(find -maxdepth 1 -type d -name 'ex[0-9][0-9]' -exec basename -- {} \; | sort -n | tail -1 | cut -c3-)"
folder_error=0
for expected_folder in $(seq -f 'ex%02g' $last_folder_num); do
[ -d "$expected_folder" ] || { folder_error=1; break; }
done
echo "$folder_error"
Might not be BSD friendly, e.g. I'm not sure if the tail -1
syntax works or if you have to say tail -n1
, or BSD seq has those flags
looks good start! lets follow the next flow:
@cubernetes
and lets no bother much about BSD-ness of solution, lets take Ubuntu as our main target. MacOs and BSD users like me should care by themselves :)
also curious if we can use comm
for that...
For example, if you miss
ex02
folder, all the rest will not give you a score. It's up to the user to decide what to submit, so I suggest that it should be "warning/informal", but for sure we should notify if there areex01
andex03
folders, but noex02
.My guess,
sort
andawk
should make it works.