toymaker.git

commit 574b9238e123348677cd0d5944dc035cf9742044

Author: Adam <git@apiote.xyz>

fix finding latest item

 get.sh | 2 +-
 start.sh | 2 +-


diff --git a/get.sh b/get.sh
index f18b89dbddb826137ce998d82b05581eb3850f63..568bc92dd164c332e407bb7538da3ceb14e29a0b 100644
--- a/get.sh
+++ b/get.sh
@@ -32,7 +32,7 @@
 show_item() {
 	toy=$1
 	item=$2
-	[ "$item" = 'latest' ] && item=$(find toys/toymaker/ -type d -mindepth 1 -maxdepth 1 | sort -n | tail -n1 | sed 's|toys/toymaker/||')
+	[ "$item" = 'latest' ] && item=$(find toys/toymaker/ -type d -mindepth 1 -maxdepth 1 | grep -E '[0-9]+' | sort -n | tail -n1 | sed 's|toys/toymaker/||')
 	if [ ! -d "toys/$toy/$item" ]
 	then
 		printf 'n;'




diff --git a/start.sh b/start.sh
index 2fb8e20d678dd680f07d4366f7ee89a156b79c02..61aec55d8363bdf45043e92936f08f54601ae4cb 100644
--- a/start.sh
+++ b/start.sh
@@ -16,7 +16,7 @@ 	done
 
 	echo $$ >"toys/$toy/.lock/pid"
 	set -e
-	lastItem=$(find "toys/$toy/" -type d -maxdepth 1 -mindepth 1 | sort -n | tail -n 1)
+	lastItem=$(find "toys/$toy/" -type d -maxdepth 1 -mindepth 1 | grep -E '[0-9]+' | sed "s|toys/$toy/||" | sort -n | tail -n 1)
 	lastItem=${lastItem:--1}
 	currentItem=$(( lastItem + 1 ))
 	mkdir "toys/$toy/$currentItem"