Last active
April 23, 2016 00:00
-
-
Save dhhdev/95a2173a9141be5a5dd9f44141dd8193 to your computer and use it in GitHub Desktop.
A script to quickly compile a file using gcc.
This file contains 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 | |
# Save the file in /usr/local/bin/ and call it whatever you like. | |
# I simply call mine: compile | |
# Now I can compile a .c file with compile test.c command. | |
if [ -z "${1}" ]; then | |
echo "We can't take over the world, without compiling a file!" | |
else | |
if [ -z "${2}" ]; then | |
gcc -ansi -Wall -pedantic ${1} -o ${1%??} | |
else | |
gcc -ansi -Wall -pedantic ${1} -o ${2} | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment