-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathmac_set_path_variable.sh
71 lines (52 loc) · 1.43 KB
/
mac_set_path_variable.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
FOLDER_PATH=$PWD
#&& echo "prepare php.ini and set include path" \
#&& sudo cp -f /etc/php.ini.default /etc/php.ini \
#&& sudo chmod u+w /etc/php.ini \
PHPINI=`php -i | grep "Loaded Configuration File"`
SEARCH="Loaded Configuration File => "
REPLACE=""
PHPINI=${PHPINI/Loaded Configuration File => }
check="include_path = '${FOLDER_PATH}'"
#&& echo "include_path = '${FOLDER_PATH}'" | tee -a ${PHPINI}
echo "" \
&& php -v \
&& echo "" \
&& echo "---------------------" \
&& echo "" \
&& echo "START \"set php.ini include_path\""
if grep -Fxq "$check" ${PHPINI}
then
echo "" \
&& echo "already available in: ${PHPINI}"
else
echo "" \
&& echo $check >> ${PHPINI} \
&& echo "set in: ${PHPINI}"
fi
echo "" \
&& echo "---------------------" \
&& echo "" \
&& echo "check if everything is successfully installed" \
&& php -r "require('lib/pan_php_framework.php');print \"PAN-OS-PHP LIBRARY - OK INSTALL SUCCESSFUL\n\";" \
&& echo "" \
&& echo "---------------------" \
&& echo ""
check="source ${FOLDER_PATH}/utils/alias.sh"
echo "START \"set user bash profile\"" \
&& echo "" \
&& echo "set $check" \
&& echo ""
array=( ".profile" ".bash_profile" ".zshrc" )
for filecheck in "${array[@]}"
do
if grep -Fxq "$check" "$HOME/$filecheck"
then
echo "already available in: $filecheck"
else
echo $check >> ~/$filecheck \
&& echo "set in: $filecheck"
fi
done
echo "" \
&& echo "END script"