summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2017-08-03 00:51:08 +0200
committerneodarz <neodarz@neodarz.net>2017-08-03 00:51:08 +0200
commit1d49bde4f0baf9f37a9d148263230274a313310c (patch)
treeea6e77e8a599f57130a1be7b444c9e8ca3b25707
parent6bc2f60c724240ecf671ffec0eeb11ebf3028dec (diff)
downloadyolorandom.cat-1d49bde4f0baf9f37a9d148263230274a313310c.zip
yolorandom.cat-1d49bde4f0baf9f37a9d148263230274a313310c.tar.xz
Add test if folder images exist
-rwxr-xr-xtest_images.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/test_images.sh b/test_images.sh
index 758a589..0525d2f 100755
--- a/test_images.sh
+++ b/test_images.sh
@@ -1,11 +1,15 @@
+mkdir -p images
count=$(ls images | grep 'back[1-9][0-9]*.jpg' | wc -w)
test=$(ls images | grep 'back[1-9][0-9]*.jpg' | sort -Vr | head -n 1 | grep "back$count.jpg")
-if [[ $test == "" ]];then
+if [[ $test == "" && $count != 0 ]];then
file=$(ls images | grep 'back[1-9][0-9]*.jpg' | sort -Vr | head -n 1)
echo "Error: There is $count file(s) but the biggest file is: $file"
if [[ $1 == "-v" ]];then
echo $(ls images | sort -V)
fi
+elif [[ $count == 0 ]];then
+ echo "You must add some images in 'images' folder with the following format:"
+ echo "'back\$.png' where \$ is a number > 0"
else
echo "All is fine !"
fi