Initial git commit
This commit is contained in:
commit
8d51bda0cc
1 changed files with 18 additions and 0 deletions
18
check_dir_empty
Executable file
18
check_dir_empty
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
dir=$1
|
||||||
|
|
||||||
|
if [ "$dir" = "" ]; then
|
||||||
|
echo "Usage: $0 <dir>" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
count=`find "$dir" -mindepth 1 -maxdepth 1 | wc -l`
|
||||||
|
|
||||||
|
if [ "$count" = "0" ]; then
|
||||||
|
echo "OK: '$dir' is empty."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "WARNING: '$dir' is NOT empty ($count entries)."
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue