From 296c71d931db518b6326088a47ee2e8c9abc587b Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Sat, 8 Aug 2020 00:36:05 +0530 Subject: moved error on exit to install section only --- Ubuntu/install-nghdl.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'Ubuntu') diff --git a/Ubuntu/install-nghdl.sh b/Ubuntu/install-nghdl.sh index fcb3eab..8450a4b 100755 --- a/Ubuntu/install-nghdl.sh +++ b/Ubuntu/install-nghdl.sh @@ -18,18 +18,6 @@ # REVISION: Sunday 02 August 2020 01:35 #=============================================================================== -set -e # Set exit option immediately on error -set -E # inherit ERR trap by shell functions - -error_exit() { - echo -e "\n\nError! Kindly resolve above error(s) and try again." - echo -e "\nAborting Installation...\n" -} - -# Trap on function error_exit before exiting on error -trap error_exit ERR - - ngspice="ngspice-nghdl" ghdl="ghdl-0.37" config_dir="$HOME/.nghdl" @@ -42,6 +30,13 @@ timestamp=`echo $sysdate|awk '{print $3"_"$2"_"$6"_"$4 }'` # All functions goes here + +error_exit() { + echo -e "\n\nError! Kindly resolve above error(s) and try again." + echo -e "\nAborting Installation...\n" +} + + function installDependency { @@ -215,6 +210,12 @@ fi ## Checking flags if [ $option == "--install" ];then + set -e # Set exit option immediately on error + set -E # inherit ERR trap by shell functions + + # Trap on function error_exit before exiting on error + trap error_exit ERR + #Calling functions installDependency if [ $? -ne 0 ];then -- cgit