From 232faedde76670fc1e962bd57c34345c8c426bdc Mon Sep 17 00:00:00 2001 From: TiagoRG Date: Fri, 6 Oct 2023 14:04:18 +0100 Subject: [PATCH] [AED] Add setup script --- 2ano/1semestre/aed/setup.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 2ano/1semestre/aed/setup.sh diff --git a/2ano/1semestre/aed/setup.sh b/2ano/1semestre/aed/setup.sh new file mode 100755 index 0000000..c657912 --- /dev/null +++ b/2ano/1semestre/aed/setup.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +if [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +if [ ! -f "$1" ]; then + echo "File $1 does not exist" + exit 1 +fi + +out_dirname=$(dirname "$1") +out_basename=$(basename "$1") + +if [ ! -d "out" ]; then + mkdir out +fi +if [ ! -d "out/$out_dirname" ]; then + mkdir -p "out/$out_dirname" +fi + +gcc -Wall -Wextra -Werror -g -o "out/$out_dirname/${out_basename%.*}" "$1" -lm + +out/"$out_dirname"/"${out_basename%.*}"