This is my install.sh
#! /bin/sh
Nginx, php, mysql Integrated Environment on # linux
# Author salamander
basepath=$(cd `dirname $0`; pwd)
Nginx installation
yum install -y gcc gcc-c++
# pcre installation
tar -zxvf pcre-8.40.tar.gz
cd ./pcre-8.40
./configure --prefix=/usr/local/pcre-8.40
make
make install
cd $basepath
# zlib installation
tar -zxvf zlib-1.2.11.tar.gz
cd ./zlib-1.2.11
./configure --prefix=/usr/local/zlib-1.2.11
make
make install
cd $basepath
# openssl installation, note openssl is. /config
tar -zxvf openssl-1.1.0e.tar.gz
cd ./openssl-1.1.0e
./config
make
make install
cd $basepath
# nginx installation note-with-pcre =-with-zlib refers to the source path
tar -zxvf nginx-1.10.3.tar.gz
cd ./nginx-1.10.3
./configure --prefix=/usr/local/nginx-1.10.3 --with-pcre=./../pcre-8.40 --with-zlib=./../zlib-1.2.11
make
make install
echo 'Nginx installed successfully!'
The last sentence will appear no matter whether it is correct or wrong. This is not good. How can we solve it?
Add a line at the beginning
set -e
, if there is a command to return non-0, stop immediately