How to redirect output to different directory in BASH?

I have 3 directories named: /home/user/control4 , /home/user/control8 ,/home/user/control16

I have written a script file which has two loops , the first one is running a simulation, producing 3 files named cc1.txt cc2.txt, and cc3.txt and a second loop is for the names of directory

I like to direct cc1.txt, cc2.txt, cc3.txt to /home/user/control4,/home/user/control8 ,/home/user/control16, respectively. What is the exact syntax for doing this in BASH?

Thanks for your help.

My script file look likes this

for j in $(4 8 16 ) # loop for directories
for i in $(seq 1 3) # loop for simulations  
.... produce cc1.txt cc2.txt cc3.txt 

How to output the three files to the respective directories? something like /home/user/control$j/cc$i.txt?



for j in /home/user/control{4,8,16}
    for i in cc{1,2,3}.txt
        produce "$j/$i"

That will produce nine files. If you want one file per directory for a total of three files, some math might do the trick.

for i in {1..3}
    produce "/home/user/control$((2*2**i))/cc$i.txt"

cat cc$i.txt > /home/user/control$j/cc$i.txt

Need Your Help

How to replace text in a column (inside a table) with Javascript without any ID

javascript html replace

The code below shows a rendered HTML (from Compiled ASP .Net code). I would not be able to make any changes to it including adding new attributes like ID.

Mysterious “errno 150” Mysql.connector python while creating bunch of tables

python mysql connector errno

So here is the problem, I have a single column in a single table that I refer to all foreign keys from other tables. I double-checked all the keys, they are all INT(11), and the column I refer to is