Need assistance with looping

Hi,

I have a find command that searches for all the .properties under current directory and its subdirectories.

 find . -name "*.properties"

I would like to pass the output of the above find command to my "operation.sh script as the second parameter.

for eg:

 
./operation.sh 775 [results of the above find command one by one]

So if the above find command returned 7 properties files the operations.sh should run 7 times taking each result as the second input.

Can you please suggest how can I ?

this might work? untested..

find . -name "*.properties" | while read line
do
./operation.sh 775 "$line"
done
1 Like

Hello mohtashims,

Following may help you in same too.

find . -name "*.properties" -exec chmod 0775 {} +

Thanks,
R. Singh