Skip to main content
support an explicit argument to the exit function
Source Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k

You may override exit in your main.sh by declaring a custom exit function at the beginning of main.sh.

#!/bin/bash
# main.sh
exit() { 
   local exit_code="${1-?}"
   test "$exit_code" -ne 0 && builtin exit "$exit_code"
   :
}
clear;
source /opt/external-svn/config.sh;
echo "$var1 and $var2 and $var3";

#unset -f exit; exit 0
builtin exit 0

You may override exit in your main.sh by declaring a custom exit function at the beginning of main.sh.

#!/bin/bash
# main.sh
exit() { 
   local exit_code="$?"
   test "$exit_code" -ne 0 && builtin exit "$exit_code"
   :
}
clear;
source /opt/external-svn/config.sh;
echo "$var1 and $var2 and $var3";

#unset -f exit; exit 0
builtin exit 0

You may override exit in your main.sh by declaring a custom exit function at the beginning of main.sh.

#!/bin/bash
# main.sh
exit() { 
   local exit_code="${1-?}"
   test "$exit_code" -ne 0 && builtin exit "$exit_code"
   :
}
clear;
source /opt/external-svn/config.sh;
echo "$var1 and $var2 and $var3";

#unset -f exit; exit 0
builtin exit 0
Source Link

You may override exit in your main.sh by declaring a custom exit function at the beginning of main.sh.

#!/bin/bash
# main.sh
exit() { 
   local exit_code="$?"
   test "$exit_code" -ne 0 && builtin exit "$exit_code"
   :
}
clear;
source /opt/external-svn/config.sh;
echo "$var1 and $var2 and $var3";

#unset -f exit; exit 0
builtin exit 0