Automatically input "yes" on the bash file
10,592
echo yes | your-program
yes yes | your-program
Related videos on Youtube
Author by
Rilin Shen
Updated on September 18, 2022Comments
-
Rilin Shen over 1 year
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.
-
pfnuesel over 6 yearsWhat are you running? Many programs have a flag for this, like
-y
, but if you don't tell us what program you run, we cannot help. -
Kusalananda over 6 yearsSome programs can take the input from standard input. Try piping the output of
yes yes
to it... That's theyes
utility executed withyes
as its only argument. -
Raman Sailopal over 6 yearsYou may have to use an expect script
-
Rilin Shen over 6 yearsThanks for your kind help. I'm running FEM code and the following answer does solve my issue.
-
-
Rilin Shen over 6 yearsThanks 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?