From 5abba4f0b920aa1847e9f81248eb377690c73994 Mon Sep 17 00:00:00 2001 From: anulax1225 Date: Tue, 23 Jan 2024 08:29:22 +0100 Subject: [PATCH] Error checking in shell script --- build.sh | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/build.sh b/build.sh index c95c0e2..290e100 100755 --- a/build.sh +++ b/build.sh @@ -19,27 +19,33 @@ fi premake5 gmake make $1 -echo ================ -echo [FINISHED BUILD] -echo ================ -if [ 1 -eq ${autoexec} ]; then - config=$1 - if [ -z "$config" ]; then - config="config=debug" - fi - if [ "config=debug" == "$config" ]; then - echo - echo ============== - echo [STARTING APP] - echo ============== - echo Config: Debug - bin/linux-x86_64-Debug/sandbox/sandbox - elif [ "config=release" == "$config" ]; then +if [ $? -eq 0 ]; then + echo Compilation Success + echo ================ + echo [FINISHED BUILD] + echo ================ + + if [ 1 -eq ${autoexec} ]; then + config=$1 + if [ -z "$config" ]; then + config="config=debug" + fi + if [ "config=debug" == "$config" ]; then + echo + echo ============== echo [STARTING APP] - echo [Config: Release] - bin/linux-x86_64-Release/sandbox/sandbox - else - echo [Aborted Launch] - echo [Config Unknown] + echo ============== + echo Config: Debug + bin/linux-x86_64-Debug/sandbox/sandbox + elif [ "config=release" == "$config" ]; then + echo [STARTING APP] + echo [Config: Release] + bin/linux-x86_64-Release/sandbox/sandbox + else + echo [Aborted Launch] + echo [Config Unknown] + fi fi +else + echo Error will compiling fi \ No newline at end of file