2

Slurm is workload manager. There are two kinds of modes to run job, interactive(srun) and batch mode(sbatch).

When using interactive mode, one needs to leave the terminal open which may lead extra burden to the remote terminal(laptop).

However, sbatch mode just submit the bash script(*.sh) and can close the remote terminal. All the following steps are handled by the computing nodes.

When I run the executable program, it prompts "Are all filenames correct?" and expects "yes". What I want is that the script to automatically input "yes" for this prompt when running *.sh file so that the program can continue without interaction.

If you need any further clarification, please let me know.

Rilin Shen
  • 23
  • 1
  • 1
  • 5

1 Answers1

15
echo yes | your-program
yes yes  | your-program
Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
  • Thanks very much, It really works. I test and find something differences between these two commands. It seems **echo yes | program** can end the program immediately and correctly after it was run, whereas **yes yes | program** cannot. Could you please give me details on this issue? – Rilin Shen Aug 24 '17 at 18:21
  • 1
    The first will send one "yes"; the second sends as many as your program will read. – Jeff Schaller Aug 24 '17 at 19:01