-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathinstall.sh
executable file
·29 lines (23 loc) · 897 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
28
29
#! /bin/bash
x=$PWD
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
# resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
# if $SOURCE was a relative symlink, we need to resolve it
# relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# Add an alias for the purpose of calling the main script by name
echo 'alias nsiqcppstyle="'$DIR'/nsiqcppstyle $@"' >> ~/.bashrc
echo '' >> ~/.bashrc
if [ $? -ne 0 ]; then
echo "Something went terribly wrong"
else
echo "Installed nsiqcppstyle for only the current user successfully ("$USER")"
echo "Please take care not to move this folder someplace else"
fi
# Go back to the original directory (if any changes were made)
cd $x