forked from nrwtaylor/stack-agent-thing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetpath
More file actions
executable file
·51 lines (40 loc) · 1011 Bytes
/
setpath
File metadata and controls
executable file
·51 lines (40 loc) · 1011 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
SERVER_DEFAULT=stackr.test
if [ "$#" -eq 0 ] ; then
SERVERNAME=$SERVER_DEFAULT
fi
if [ "$#" -gt 1 ] ; then
echo "Usage: $0 ServerName"
echo $1 $2 $3
exit 0
fi
if [ "$#" -eq 1 ] ; then
SERVERNAME=$1
fi
echo "Default: $SERVER_DEFAULT"
echo "Your Home directory: $HOME"
echo "Your Entry: $1"
echo "Option used: $SERVERNAME"
#Check for profile file
if [ -f "$HOME/.profile" ] ; then
echo ".profile exists"
Path_File=.profile
elif [ -f "$HOME/.bash_profile" ] ; then
echo ".bash_profile exists"
Path_File=.bash_profile
elif [ -f "$HOME/.bash_login" ] ; then
echo ".bash_login exists"
Path_File=.bash_login
fi
#Add path to profile file
echo "Change Profile: $Path_File"
cat <<ADDTEXT1 >> $HOME/$Path_File
# Add Stackr Interactive Tool path
if [ -d "/var/www/$SERVERNAME" ]; then
export PATH="/var/www/$SERVERNAME:\$PATH"
fi
ADDTEXT1
source $HOME/$Path_File
echo "Remember to source your $Path_File"
echo "> source $HOME/$Path_File"
echo "Or start a new shell session"