-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
27 lines (23 loc) · 1009 Bytes
/
install.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
#!/bin/bash
cd cpp_genclass/
SHELL_NAME=$(echo "$SHELL" | rev | cut -d'/' -f1 | rev)
SHELL_RC="$HOME/.$SHELL_NAME"rc
mkdir "$HOME"/.cpp_genclass
if [ $? != 0 ]
then
echo "[LOG] - Aborting genclass installation -- fix problems and restart with 'bash install.sh"
exit 1
fi
mv -f -t "$HOME"/.cpp_genclass/ genclass LICENSE class_cpp_template class_hpp_template main_cpp_template README.md
cat "$SHELL_RC" | grep "export PATH=\$PATH:$HOME/.cpp_genclass" > /dev/null
if [ $? != 0 ]
then
echo -e "\n""export PATH=\$PATH:$HOME/.cpp_genclass" >> "$SHELL_RC"
SHELL_LINE_ADDED=$(cat "$SHELL_RC" | wc -l)
echo "[LOG] - PATH export variable has been added, see $SHELL_RC line $SHELL_LINE_ADDED"
else
echo "[LOG] - PATH export variable has not been added because it already exists in $SHELL_RC"
fi
rm -f install.sh
echo "[LOG] - cpp_class generator has been successfully installed"
echo "[LOG] - Try 'genclass --help' to ensure the installation worked (you might need to restart terminal or 'source' your shell)"