使用zypper时,如何才能自动选 yes

像 yum,会有个 yum -y 参数设置,可以自动选yes,而不需要人工输入
想把zypper install xxxxx 写入 .sh脚本中,但是运行时会有 “Continue? [y/n/…? shows all options] (y):”,这时还是需要人工输入;
zypper 有没有什么参数设置,可以设置后,这个地方默认取参数而不需要人工输入??

Hi
The command would be;


zypper in -y or --no-confirm xxxxx
zypper in --help for more options

thx,十分感谢,我之前把 -y放在的install 前,不好使,原来是放在后面,再次感谢

Useful zypper commands for BASH scripting

https://en.opensuse.org/User:Tsu2/BASH_zypper

You’ll find various install scripts sprinkled through a number of articles in my wiki

https://en.opensuse.org/User:Tsu2

You’ll also see an example of what you’re asking about in a script I wrote recently
If for instance you’re only interested in the early part of this script, strip out anything you don’t want and insert what you want your script to do.
This script does the following automatically without any User interaction

  • Detect whether your openSUSE is LEAP or Tumbleweed (or something else)
  • Add repos, appropriately named for the openSUSE version
  • Auto agree to accept the repo gpg keys
  • Install packagesi

https://github.com/putztzu/lc0/blob/master/install_openSUSE_lc0.sh

HTH,
TSU