Quote:
Originally Posted by lorcan
A small correction blowtorch.
Code:
for file in *; do
if [ -d $file ]; then
mkdir $file/test;
fi
done
Since you had issued a cd command it would create the sub-dir only for the first directory. So the result would not be as expected.
|
Hi, I had a question about the cd thing, how come it doesn't work? I'm modifying the code to go into certain subfolders in each folder and then execute a command so I wasn't sure how to do that. Basically I'm trying to do something like this now...
current directory:
a b c
Inside of each directory there is a file here (using a as an example):
a/test/folder/script.sh
Sorry for the generic names. Now what I want my script to do is access that script.sh in each folder and run it. I was gonna do the for statement and then cd into that path and then do an execute command but I guess it's not that simple. Any ideas? thanks!