-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest2.sh
163 lines (128 loc) · 2.87 KB
/
test2.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# not-xcode() {
# if [[ $(xcode-select -p 1>/dev/null 2>/dev/null; echo $?) == 2 ]]
# then
# return false
# else
# return true
# fi
# }
# if [[ not-xcode ]]
# then
# echo "hello not xcode"
# else
# echo "hello x code"
# fi
# is_xcode_installed() {
# xcode-select -p 1>/dev/null 2>/dev/null
# }
# if ! is_xcode_installed
# then
# echo "xcode is not installed"
# else
# echo "xcode is installed"
# fi
# until is_xcode_installed
# do
# echo "xcode installation in progress"
# sleep 2
# done
# if [[ ! $(git config --global user.name) ]]
# then
# echo "config is not set"
# else
# echo "config is set"
# fi
# setup_git_ssh() {
# location=~/.ssh/id_ed25519
# if [[ -r ${location} ]]
# then
# echo "ssh key exists"
# else
# echo "ssh key does not exist"
# fi
# }
# setup_git_ssh
# curl -fsSL https://raw.githubusercontent.com/piyush1104/dotfiles/master/macos/Brewfile | brew bundle --file=-
# setup_git_ssh() {
# location=~/.ssh/id_ed2fds5519
# if [[ -e ${location} && -r ${location} ]]
# then
# echo "key exists already"
# return
# fi
# echo "key does not exist"
# }
# setup_git_ssh
# setup_github() {
# # ssh-add -K ~/.ssh/id_ed25519
# # cat ~/.ssh/id_ed25519.pub
# sleep 1
# echo ""
# echo "Do you want to add the ssh key to github? Type y for yes"
# read -r -p "**** waiting for input **** "
# if [[ $REPLY != "y" ]]
# then
# return
# fi
# echo "ok setting up github"
# }
# setup_github
# read -r -p "hello === "
# check_sudo_access(){
# sudo -n true 2> /dev/null
# }
# if ! check_sudo_access
# then
# echo "Please provide your admin password"
# sudo -v
# else
# echo "sudo is already active"
# fi
# if ! check_sudo_access
# then
# echo "Please provide your admin password"
# sudo -v
# else
# echo "sudo is already active"
# fi
# is_process_active() {
# kill -0 $$ 1>/dev/null 2>/dev/null
# }
# # sudo -v
# refresh_sudo() {
# echo "inside refresh_sudo"
# while true
# do
# echo "inside the while loop"
# # sudo -n true
# sleep 1
# if ! is_process_active
# then
# echo "process is not active, exiting the background process (while loop)"
# exit
# else
# continue
# # echo "process is still active, not exiting"
# fi
# done
# }
# echo "$$"
# refresh_sudo&
# echo "after refresh_sudo"
# sleep 3
# if (is_process_active)
# then
# echo "process is active"
# else
# echo "process is not active"
# fi
# echo $($(is_process_active) || echo "hello")
# echo $($(kill -0 12344231) || echo "hello")
# while true; do echo $$; exit; done &
# sleep 4
# if (is_process_active)
# then
# echo "process is active"
# else
# echo "process is not active"
# fi