Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Expert guru

I need your help. I have a command which I am running in terminal colsole.
I want to make it run for all the files in the folder one by one and save the output as txt file. At the moment, I can only run it one by one manually for single file and get the output in colsole.

Original command is
python main.py -m test -class input.csv 

and
I am trying looping like this in shell script loop

for file in  *.csv; 
do
    python main.py -m test -class  <"$file" &
done


can you help me in making a proper loop?

Greetings

What I have tried:

I am trying to make a shell script .sh file for the looping command for all available files which get run one by one and save the output which is text in console.
Yet I am only able to run this command in colsole terminal manually each time.
Posted
Updated 21-Feb-19 18:55pm
Comments
Richard MacCutchan 21-Feb-19 7:27am    
What is the problem?

1 solution

Delete the &. With it there, each python command is launched as a separate background process, so they will all run in a terrible jumble. Without the &, they will run sequentially as you expect.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900