Asked • 06/12/19

What does set -e mean in a bash script?

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 script has the following code: #!/bin/bash set -e # Automatically added by dh_installinit if [ "$1" = install ]; then if [ -d /usr/share/MyApplicationName ]; then echo "MyApplicationName is just installed" return 1 fi rm -Rf $HOME/.config/nautilus-actions/nautilus-actions.conf rm -Rf $HOME/.local/share/file-manager/actions/* fi # End automatically added section My first query is about the line: set -e I think that the rest of the script is pretty simple: It checks whether the Debian/Ubuntu package manager is executing an install operation. If it is, it checks whether my application has just been installed on the system. If it has, the script prints the message **"MyApplicationName is just installed"** and ends (`return 1` mean that ends with an “error”, doesn’t it?). If the user is asking the Debian/Ubuntu package system to install my package, the script also deletes two directories. Is this right or am I missing something?

1 Expert Answer


Richard H. answered • 01/24/20

New to Wyzant

Senior Linux Systems Engineer with Red Hat certification.

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.