I'd like to see if "/tmp" dir contains hidden dir and dir named "test"
Currently ls -la /tmp contains below
.
..
testI'd like to check if /tmp doesn't contain anything else besides above using shell script?
01 Answer
You could use this command to list any hidden directories and avoid listing "." which refers to directory itself.
find /tmp -maxdepth 1 -type d -iname ".*" -a -not -name "."Output of this command can either piped to grep or used in a variable and tested with [ -z "$VAR" ] to check if the string is empty. If it is, there's no hidden directories