TCSH / CSH / C Shell Check Whether a Directory is Empty or Not
In the TCSH (also known as the C shell), you can check whether a directory is empty or not using the ls command and the test command. Here’s how: if ( ! (`ls -A $dir 2>/dev/null`) ) then echo “$dir is empty” else echo “$dir is not empty” endif In this example, the ls command … Read more