-
Notifications
You must be signed in to change notification settings - Fork 4
/
new-cpp.sh
33 lines (28 loc) · 1.09 KB
/
new-cpp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Get the base name
bn="${1##*/}"
bn="${bn%.*}"
if [ -e $1.hpp ]
then
echo "File $1.hpp already exists! I will not overwrite it!"
exit 1
fi
if [ -e $1.cpp ]
then
echo "File $1.cpp already exists! I will not overwrite it!"
exit 1
fi
echo "//--------------------------------------------------------------------------------" > $1.hpp
echo "// $bn.hpp" >> $1.hpp
echo "//--------------------------------------------------------------------------------" >> $1.hpp
echo "// <insert description here>" >> $1.hpp
echo "//--------------------------------------------------------------------------------" >> $1.hpp
echo "#pragma once" >> $1.hpp
echo "" >> $1.hpp
echo "//--------------------------------------------------------------------------------" > $1.cpp
echo "// $bn.cpp" >> $1.cpp
echo "//--------------------------------------------------------------------------------" >> $1.cpp
echo "// <insert description here>" >> $1.cpp
echo "//--------------------------------------------------------------------------------" >> $1.cpp
echo "#include \"$bn.hpp\"" >> $1.cpp
echo "" >> $1.cpp