skip to Main Content

This is my code, I don’t understand it completely. I would really appreciate your help

#!/bin/sh

set -e

envsubst < /etc/nginx/default.conf.tpl > /etc/nginx/conf.d/default.conf

nginx -g 'daemon off;'


2

Answers


  1. it is flag for sh you can look at man sh its description

     -e errexit       If not interactive, exit immediately if any
                                untested command fails.  The exit status of a com‐
                                mand is considered to be explicitly tested if the
                                command is used to control an if, elif, while, or
                                until; or if the command is the left hand operand
                                of an “&&” or “||” operator.
    
    Login or Signup to reply.
  2. It’s not an Nginx thing, it’s a Unix shell thing, the set command. set -e means:

    When this option is on, if a simple command fails for any of the reasons listed in Consequences of Shell Errors or returns an exit
    status value >0, and is not part of the compound list following a while, until, or if keyword, and is not a part of an AND or OR
    list, and is not a pipeline preceded by the ! reserved word, then the shell shall immediately exit.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search