I want to make a list of my subdirectories. When I execute the following for loop, the first directory name occurs two times
for d in */; do
echo $d >> directories.txt
done
The output is like :
ONE/
TWO/
ONE/
Where is the problem?
bash
I want to make a list of my subdirectories. When I execute the following for loop, the first directory name occurs two times
for d in */; do
echo $d >> directories.txt
done
The output is like :
ONE/
TWO/
ONE/
Where is the problem?
Best Answer
Improving you current code, this command should be helpful:
To remove the
./
from the output: