Skip to content

Instantly share code, notes, and snippets.

@GasparCorrea
Created October 11, 2016 01:47
Show Gist options
  • Save GasparCorrea/733dcc7b7174a3d64d0ed619e4bde926 to your computer and use it in GitHub Desktop.
Save GasparCorrea/733dcc7b7174a3d64d0ed619e4bde926 to your computer and use it in GitHub Desktop.
#!/bin/bash
mkdir $1
cd ./$1
touch "$1.cpp"
echo "$1: $1.cpp" > makefile
echo " g++ $1.cpp -o $1" >> makefile
echo '#include <iostream>' >> $1.cpp
echo '' >> $1.cpp
echo 'using namespace std;' >> $1.cpp
echo '' >> $1.cpp
echo 'int main()' >> $1.cpp
echo '{' >> $1.cpp
echo ' return 0;' >> $1.cpp
echo '}' >> $1.cpp
vim $1.cpp
@GasparCorrea
Copy link
Author

Template for a new C++ project.

To execute:

new_cpp.sh foo

The script does the following:

  • Create folder named foo and a foo.cpp with its makefile.
  • Open foo.cpp with vim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment