What does set -e mean in a bash script?

后端 未结 8 969
醉酒成梦
醉酒成梦 2020-11-22 15:46

I\'m studying the content of this preinst file that the script executes before that package is unpacked from its Debian archive (.deb) file.

The scr

8条回答
  •  情歌与酒
    2020-11-22 16:27

    Script 1: without setting -e
    #!/bin/bash
    decho "hi"
    echo "hello"
    This will throw error in decho and program continuous to next line
    
    Script 2: With setting -e
    #!/bin/bash
    set -e
    decho "hi" 
    echo "hello"
    # Up to decho "hi" shell will process and program exit, it will not proceed further
    

提交回复
热议问题