user599086
user599086

Reputation: 29

bash file and running the c++ code multiple times

I am using Ubuntu to write c++ programs. I am using a bash file to run my program multiple times using different arguments. However, only the first run is executed !

This is my bash file

#!/bin/bash

cd ~/Desktop/MyCodeWorkspace

g++ a.cpp b.cpp c.cpp main.cpp -o myProgram

./myProgram 8 0

./myProgram 8 20

./myProgram 8 40

./myProgram 8 60

Upvotes: 0

Views: 248

Answers (2)

user599086
user599086

Reputation: 29

Thanks for your help. It is my mistake. At the end of my main I have ( int x; cin>>x) so I can pause the terminal(a problem that suddenly happen, and I could not solve). I forgot that I added this line.

Upvotes: 0

Cedric
Cedric

Reputation: 199

Probably that your bash program is stuck in the first program. Make sure that myProgram returns when it is executed.

Upvotes: 1

Related Questions