如何执行“make; make install“在bash脚本中?

问题描述 投票:0回答:1

我需要在bash脚本中自动安装NRPE代理。如何在远程目录中“make; make install”?这是迄今为止的代码:

#!/bin/bash

for f in *.tar.gz
do
    tar zxf "$f" -C /home/$USER/
done

sudo useradd -s /sbin/nologin -M nagios

/home/$USER/nagios-plugins-2.2.1/configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib64/

因此,在“configure”部分结束后,我需要执行“make; make install”。另外,有没有办法优化当前脚本?

bash scripting gnu-make configure nagios
1个回答
2
投票

这可能有助于Khanna111's hint

cd /home/$USER/nagios-plugins-2.2.1 || exit 1
configure <options> && make && sudo make install
© www.soinside.com 2019 - 2024. All rights reserved.