Basically just like the title says…
I want to ls the directory that I’m currently running my script in, and for every folder in the directory, cd into that directory and execute my script using the folder name as the argument.
ie: In ${HOME} I have 2 directories say ’31’ and ’32’ (will always be numerical and incremental like that)
So, in my script I’m going to cd in 31, rsync some files into that directory from another machine, cd .., then cd into 32 and repeat till there are no more folders.
I have everything working with my current get.exp and running:
for x in ls; do cd $x ; get.exp $x ; cd .. ; done
as a bash alias. But I’d love to cut out the alias…
The tcl equivalent of your loop is
You might be able to simplify that (perhaps just using
source get.expor calling the appropriate proc) but it’s the same basic idea.