linux - Output from a bash script looping through multiple directories -


i trying write script loop through multiple directories. main raw_data directory contains ~150 subdirectories (subj001, subj002,...,subj00n), each of has several subdirectories.

how can make sure output script given bellow sent specific subdirectory (e.g. subj0012) input taken from, rather current directory (raw_data)?

#!/bin/bash  dir in ~raw_data/*   tractor -d -r -b preproc runstages:1  done  

thank you.

the name of dir want save output in $dir, right? so, send output there via redirection:

#!/bin/bash dir in ~raw_data/* ;     tractor -d -r- b preproc runstages:1 > $dir/output done 

you should make sure processing directory, though.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -