I have a small python program that parses a text file and writes the output to another file. Currently, I am writing a bash script to call this program several times, it looks something like:
for i in $(seq 1 100); do
python /home/Documents/myProgram.py myTextFile$i
done
This works fine but I want to know if it is possible to have the python program inside the bash script file so when another user runs the script they don't need to have the python program in their memory; i.e., is it possible to copy and paste the python program into the bash script and run it from within the script itself?
echothe program to a file next to the script, run it from there, andrmthat file afterwards. But really, don't do this. You won't have any syntax highlighting for that program, making it close to impossible to maintain. Rather just package it together with the script, or make your Python script to replace the bash part entirely.forloops.