ionutb - tech & more
Sunday, January 2, 2011
Shell script: test dir exists and is not empty
Test if directory exists and if directory is not empty
#!/bin/bash
ddir='/mnt/dirname'
if [[ -d $ddir && `ls $ddir | wc -l` > 0 ]]; then
echo 'directory exists and is not empty';
fi
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment