Skip to content

Instantly share code, notes, and snippets.

@dhhdev
Last active April 23, 2016 00:00
Show Gist options
  • Save dhhdev/95a2173a9141be5a5dd9f44141dd8193 to your computer and use it in GitHub Desktop.
Save dhhdev/95a2173a9141be5a5dd9f44141dd8193 to your computer and use it in GitHub Desktop.
A script to quickly compile a file using gcc.
#!/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