I'd like to see if "/tmp" dir contains hidden dir and dir named "test"
Currently ls -la /tmp contains below
.
..
test
I'd like to check if /tmp doesn't contain anything else besides above using shell script?
I'd like to see if "/tmp" dir contains hidden dir and dir named "test"
Currently ls -la /tmp contains below
.
..
test
I'd like to check if /tmp doesn't contain anything else besides above using shell script?
You could use this command to list any hidden directories and avoid listing "." which refers to directory itself.
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