]> Sergey Matveev's repositories - sgmon.git/commitdiff
Fix correct working with hierarchy of directories
authorSergey Matveev <stargrave@stargrave.org>
Tue, 29 Mar 2022 15:41:28 +0000 (18:41 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 29 Mar 2022 15:45:25 +0000 (18:45 +0300)
probelist.sh

index 28a4eb50826baca97ca5dfa3c7f6f74033259c3f..6e6eca27238476fa59ae95a1eef0d667ed043502 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh -e
 
-find . -mindepth 1 -type d -not -name ".*" | while read probe ; do
-    [ -e $probe/run ] || continue
-    echo ${probe#./}
-done | sort
+nondot() {
+    find $1 -mindepth 1 -maxdepth 1 -type d -not -name ".*" | while read d ; do
+        [ -e $d/run ] && echo ${d#./} || nondot $d
+    done
+}
+
+nondot . | sort