Skip to content

Commit

Permalink
Fix Super-Linter Bash linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
BDadmehr0 authored Nov 21, 2024
1 parent 6aaad40 commit 9060c17
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,25 @@ sources=(
# Compile each source file into an object file
for src in "${sources[@]}"; do
echo "Compiling $src..."
gcc -c "$src" -o "${src%.c}.o"
if [ $? -ne 0 ]; then
if ! gcc -c "$src" -o "${src%.c}.o"; then
echo "Error: Compilation failed for $src"
exit 1
fi
done

# Link all object files into the final executable
echo "Linking object files..."
gcc -o "$output" *.o
if [ $? -ne 0 ]; then
if ! gcc -o "$output" ./*.o; then
echo "Error: Linking failed"
exit 1
fi

# Clean up object files (optional)
# rm *.o
# rm ./*.o

# Run the executable with the provided argument
echo "Running the executable..."
./"$output" ../example/test6.salam ../out/
if [ $? -ne 0 ]; then
if ! ./"$output" ../example/test6.salam ../out/; then
echo "Error: Execution failed"
exit 1
fi
Expand Down

0 comments on commit 9060c17

Please sign in to comment.