From 76427d00f68135dad375f76dcf2930048390dd44 Mon Sep 17 00:00:00 2001 From: TiagoRG Date: Thu, 12 Oct 2023 15:05:01 +0100 Subject: [PATCH] [AED] Update setup.sh Signed-off-by: TiagoRG --- 2ano/1semestre/aed/setup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/2ano/1semestre/aed/setup.sh b/2ano/1semestre/aed/setup.sh index c657912..a35e61b 100755 --- a/2ano/1semestre/aed/setup.sh +++ b/2ano/1semestre/aed/setup.sh @@ -1,5 +1,8 @@ #!/bin/bash +parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P ) +cd "$parent_path" || exit + if [ $# -ne 1 ]; then echo "Usage: $0 " exit 1 @@ -22,4 +25,9 @@ fi gcc -Wall -Wextra -Werror -g -o "out/$out_dirname/${out_basename%.*}" "$1" -lm +if [ $? -ne 0 ]; then + echo "Compilation failed" + exit 1 +fi + out/"$out_dirname"/"${out_basename%.*}"