FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sourcegraph/dev/add_https_domain_to_hosts.sh at main · hfern/sourcegraph · GitHub
hfern
/
sourcegraph
Public
forked from
sourcegraph/sourcegraph-public-snapshot
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
sourcegraph
/
dev
/
add_https_domain_to_hosts.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
24 lines (18 loc) · 642 Bytes
Breadcrumbs
sourcegraph
/
dev
/
add_https_domain_to_hosts.sh
Copy path
File metadata and controls
executable file
·
24 lines (18 loc) · 642 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!
/usr/bin/env bash
set
-euf -o pipefail
cd
"
$(
dirname
"
${BASH_SOURCE[0]}
"
)
/..
"
hosts=/etc/hosts
domain=
"
${SOURCEGRAPH_HTTPS_DOMAIN
:-
"
sourcegraph.test
"
}
"
entry=
"
$(
printf
"
\n127.0.0.1\t%s
"
"
${domain}
"
)
"
if
grep -q -w -F --
"
${domain}
"
"
${hosts}
"
;
then
echo
"
---
${domain}
already exists in
${hosts}
"
elif
[
-w
"
${hosts}
"
]
;
then
#
Don't need sudo
echo
"
--- adding
${domain}
to
${hosts}
"
echo
"
${entry}
"
>>
"
${hosts}
"
else
echo
"
--- adding
${domain}
to
${hosts}
(you may need to enter your password)
"
sudo ENTRY=
"
${entry}
"
HOSTS=
"
${hosts}
"
bash -c
'
echo "${ENTRY}" >> "${HOSTS}"
'
fi
echo
"
--- printing
${hosts}
"
cat
"
${hosts}
"
Back
|
FazBrowse Home
|
New Git URL