Created
July 12, 2021 05:02
-
-
Save pluveto/e519fcfe0e7faf964cede36ad7842819 to your computer and use it in GitHub Desktop.
Compile and run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -n "$1" ] ;then | |
echo -e "\033[31mMissing source file name!\033[0m" | |
exit 1 | |
fi | |
# echo -e "\033[33m"`date`"\033[0m" | |
outputBinaryFileName=`basename $1 .cpp`'.out' | |
g++ $1 -o $outputBinaryFileName -std=c++11 -I ~/leet/inc | |
if [ $? -ne 0 ];then | |
echo -e "\033[31mCompilation error!\033[0m" | |
exit 1 | |
fi | |
ts=$(date +%s%N) ; ./$outputBinaryFileName ; tt=$((($(date +%s%N) - $ts)/1000000)) | |
echo -e "\033[33m■\033[0m" | |
echo -e "\033[32m ┌──End of program──" | |
echo " │ Finished in $tt ms." | |
echo -e "\033[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment