-
Notifications
You must be signed in to change notification settings - Fork 16
/
remove_path_variable.sh
81 lines (57 loc) · 1.5 KB
/
remove_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
72
73
74
75
76
77
78
79
80
81
#!/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}'"
#"${string//,/$'\n'}"
CHECKSED=${check/\//'\/'}
#CHECKSED="$check" | sed -r 's/[\/]+/\\\//g'
#&& echo "include_path = '${FOLDER_PATH}'" | tee -a ${PHPINI}
echo "" \
&& php -v \
&& echo "" \
&& echo "---------------------" \
&& echo "" \
&& echo "START \"check php.ini include_path\"" \
&& echo "remove $check" \
&& echo "SED: |"$CHECKSED"|"
if grep -Fxq "$check" ${PHPINI}
then
echo "" \
&& echo "available in: ${PHPINI}" \
&& echo "check how to remove" \
&& sed "s/$CHECKSED// ${PHPINI}" \
&& echo ""
else
echo "" \
&& echo "not available in: ${PHPINI}"
fi
echo "" \
&& echo "---------------------" \
&& echo ""
check="source ${FOLDER_PATH}/utils/alias.sh"
echo "START \"check user bash profile\"" \
&& echo "" \
&& echo "remove $check" \
&& echo ""
array=( ".profile" ".bash_profile" ".zshrc" )
for filecheck in "${array[@]}"
do
if grep -Fxq "$check" "$HOME/$filecheck"
then
echo "available in: $filecheck" \
&& echo "check how to remove" \
&& sed "s|$check| $HOME/$filecheck|" \
&& echo ""
else
echo "" \
&& echo "not available in: $filecheck"
fi
done
echo "" \
&& echo "END script"