# for /bin/sh
set -x
apt_option="-o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' --ignore-missing -y "
eval "sudo apt-get ${apt_option} install snmpd"
注意:不能在/bin/sh 脚本中直接引用${apt_option}变量,否则会当成一个参数,而不是多个参数,只能通过eval 执行,可以 通过 set -x 查看 解析过程
Configuration file '/etc/snmp/snmpd.conf'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
==> Keeping old config file as default.