I execute a command in a script, for example svn. Sometimes, to continue the work of a team, it is required to agree with something, i.e. some time after launch, answer yes. How to achieve this in the script?

  • Usually, scripted programs have a mode of operation without asking for confirmation. - VladD
  • Which program exactly wants to ask you for confirmation? svn client? - VladD
  • For example, svn has a key --non-interactive - VladD
  • --non-interactive did not help, because instead of yes, it asks for a password, although I am transferring logs and a password - Oleg From
  • Are you sure that the password comes correctly? Check what is being called. (For example, temporarily replace the svn call with a call to your utility, which logs the command line.) - VladD

2 answers 2

try to add before calling svn ... call yes and pipe ( pipe ) | so that the line looks like this:

 yes | svn ... 

this is if the "consent symbol" should be y . if there should be some other line, specify it with a parameter for the yes program.

For example, if svn requires a Y character, then the string should look like this:

 yes Y | svn ... 

and if the word is yesss , then so:

 yes yesss | svn ... 

    There is a utility yes . By redirecting its output it is just possible to achieve such a result.