So I am trying to do this for practice just to get an understanding but if I have a code in say test.cpp and I want to change a line in the program say "CONST N = 10" that changes the value of N to different values through a loop in a bash script how would I do that ? My initial guess was to do:
for x in 10 20 do sed -i -e 's/const int N = 10;/const int N = '$x';/g' test.cpp g++ test.cpp -o test.o ./test.o sed -i -e 's/const int N = '$x';/const int N = 10;/g' test.cpp done
where x would run through 10, and 20 and then input those values into the variable value in the program... But I am unsure if that is what I should be doing or not. Any help would be greatly appreciated.