MSUStudentWork/makefile.sh

24 lines
607 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
find . -type f -name "makefile" | while read -r file; do
echo "Processing file: $file"
tmp_file=$(mktemp)
if [ "$1" == "delete" ]; then
# Удаление строк с a.exe
sed -e '/a\.exe/d' \
-e 's/\<del\>/rm/g' \
-e 's/\-lssp//g' "$file" > "$tmp_file"
else
# Замена a.exe на ./a.out
sed -e 's/a\.exe/\.\/a\.out/g' \
-e 's/\<del\>/rm/g' \
-e 's/\-lssp//g' "$file" > "$tmp_file"
fi
mv "$tmp_file" "$file"
echo "File $file processed."
done
echo "All Makefiles processed."