about subdirectories
hi folks,
i want to know a shell command that enables me to check that my current directory have some directories or not and asolutly their names if possible? i have tried test command but i cant do it. thanks in advance. |
Code:
find . -maxdepth 1 -mindepth 1 -type d Code:
for file in * .*; do if [ -d "$file" ] ; then echo "$file"; fi; done |
thank u for wonderful answer
it is really so useful for me , i have used find command u sent but, i want to save the result into a shell array variable thanks in advance |
when i tried the following:
directories=`find . -maxdepth 1 -mindepth 1 -type d` echo $directories i got ./folder1 ./folder2 but i want to access each of (folder1 and folder2)alone,how can i do that i.e. i want to assign ./folder1 to a variable while ./folder2 to another variable |
Here's a generic solution for getting the arguments one at a time. You can then put them into array cells, run code on them, whatever you please.
Code:
i=0 |
All times are GMT -5. The time now is 09:11 AM. |