Writing batch file and c++

My is c++ is for running multiple algorithms with different parameters a,b,c that has to be send when executing algorithms 1,2,3. In each run, I need to change a,b, c. The results of each different run is saved in Excel file.

My professor suggested that instead of manually running the c++ program and changing the parameters in each run, It is useful for me to write a batch file and let it run for one day then I will have considerable amount of results in the Excel file.

How could I write a batch file in Linux(Ubuntu)? Is there any example or tutorial that I can start from?
This looks like just a tutorial for writing shell scripts, which you can use to batch commands, but there are some issues in it.

> Once you have prepared your batch file, you will have to save the file with any name, but with the extension ‘.sh’ at the end of the file name.

This is not correct. A shell script doesn't need to end in .sh, and if it's something you intend to run from the command line, it probably shouldn't have an extension at all (you don't run ls.elf or zgrep.sh).

The quotes are also the special curly quote character, and not the actual quote character.

~ λ mkdir -p ~/tmp/”$(date +”%d-%m-%Y”)”
~ λ ll ~/tmp
total 0
drwxr-xr-x  2 nickchambers  admin  64 Jan  7 18:17 ””07-01-2021””/

http://mywiki.wooledge.org/BashGuide is a great resource for learning Bash (and sh) scripting as well as some of the standard utilities.

edit: they also really should use a shebang as well. I believe Linux by default will just feed it through /bin/sh if it doesn't detect any magic symbols, but it's still a good idea to be explicit.
Last edited on
I'm not a Linux user, so I defer to your expertise, uplime.
It's definitely a good topic to know about, but unfortunately too many shell scripting resources on the internet are riddled with mistakes :(
The first link I gave was a hybrid Win/Linux one. The Win portion wasn't all that bad, a bit amateurish, so I expected the Linux portion to be about the same.

That is why I added my meta search to the mix. :)
Registered users can post here. Sign in or register to post.