How to add set -e to all default bashes?

J. Doe

To make a bash script exit after any failed command, you can add

set -e

Imagine, you have a CI agent which allow people to embed bash scripts as tasks in build jobs.

How to make the exit behaviour given by set -e default for all new bash instances? Is there some sort of bashrc hack for that?

Isaac

You can make the present running bash shell activate the -e option with:

$ set -e

Just to confirm:

$ echo "$-"
himBHs
$ set -e
ehimBHs

As the bashrc file is sourced to interactive shells you can make all new bash shells use the -e option by adding this:

set -e

As one line at any place (that is executed) of the .bashrc script.

This is a very bad idea however, as there are many conditions under which the detection of a failed command fails and there are several cases where a failed command is desirable. Please read

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

When I add new row in the table, how can I set default value for all the decimal column in the new

How to set Default CSS for all Buttons in JAVAFx

How to set "all values" as default in a multiple select?

How to set default workspace location for all users?

How to set default DISPLAY for all SSH sessions?

How to set a default attribute to all elements

how to add a method to all controller by default in laravel?

How to add a default parameter for all routes in laravel

How to add all strings in a file to a set?

How to set default file permissions for all folders/files in a directory?

How to set "View all release pipelines" as default view in Release Pipelines

How to set default read privileges for all localhost projects?

How to set default value to all keys of a dict object in python?

How to set the default color cycle for all subplots with matplotlib?

How to set all possible relationships of has_many as default in SilverStripe

How to set a default pointtype to use in all plots in gnuplot?

How to set default value for all dags with DAG cluster policy?

How to set a default ssh user for all hosts in Ansible?

How do I set my default theme for all icons on Antd?

Problem with MVC Routing how to set default action of all Controller?

how to set all widgets values to default by clicking on a widget button?

How to set a specific window size and placement for all windows that open to default

How to set default all checked for some choice in PHP

How to set default Cell Setup to all type of cells?

How to automatically add !default to all SASS/SCSS variables

How add default packages to all new python's venvs

How to add target={_blank} to all editor links by default?

How to change column charset, set as not null and add a default value?

SSRS How to set default parameter NOT select all, but using a where clause as the default?