I need to run several tasks in sequence. The task names are listed in a file (jobs.txt). I use the following code (example):
#! /bin/bash while IFS=$'\r' read -r line || [[ -n "$line" ]]; do echo $line done < "jobs.txt"
It works well. However, I need to run these tasks with openmpi (in this example, change "echo $line" to "mpirun -n 4 echo $line"), then the script does not work any more... It only read the first line from "jobs.txt" and stopped.
Any idea what's the problem and how to fix it?