mercredi 28 janvier 2015

Unix: Looking to run a script in directories with a certain name


I am writing a script in bash.


If I am in directory Foo, I want to run this script in only the subdirectories of foo that are named foo with up to three numbers after foo.


Ex: foo1, foo23, foo345 etc..


Test is the name of my script.


This is what I have so far. I cannot remember how to specify exactly what directories I want this script to look for.


Other things of importance: I am running on ssh client.



for i in sol*
do
if [ -d $i ]
then
sh ./test
echo "Test is working."
fi
done


Aucun commentaire:

Enregistrer un commentaire