mirror of
https://github.com/hectorm/hblock.git
synced 2026-04-22 23:16:36 +05:30
Ignore comments regardless if they are at the beginning of the line
This commit is contained in:
parent
fd311f89e0
commit
472fabe64e
1 changed files with 3 additions and 3 deletions
6
hblock
6
hblock
|
|
@ -549,8 +549,8 @@ main() {
|
|||
if [ -s "${sourcesFile:?}" ]; then
|
||||
printInfo 'Downloading sources'
|
||||
|
||||
# Read the sources file ignoring lines that start with "#" or are empty.
|
||||
sed -e '/^#/d;/^$/d' -- "${sourcesFile:?}" | while IFS= read -r url || [ -n "${url?}" ]; do
|
||||
# Read the sources file ignoring comments or empty lines.
|
||||
sed -e 's/[[:blank:]]*#.*//;/^$/d' -- "${sourcesFile:?}" | while IFS= read -r url || [ -n "${url?}" ]; do
|
||||
printList "${url:?}"
|
||||
if fetchUrl "${url:?}" > "${blocklistFile:?}.aux"; then
|
||||
{ cat -- "${blocklistFile:?}.aux"; printf '\n'; } >> "${blocklistFile:?}" \
|
||||
|
|
@ -581,7 +581,7 @@ main() {
|
|||
if [ -s "${allowlistFile:?}" ]; then
|
||||
printInfo 'Applying allowlist'
|
||||
# Entries are treated as regexes depending on whether the regex option is enabled.
|
||||
sed -e '/^#/d;/^$/d' -- "${allowlistFile:?}" >> "${blocklistFile:?}.pat"
|
||||
sed -e 's/[[:blank:]]*#.*//;/^$/d' -- "${allowlistFile:?}" >> "${blocklistFile:?}.pat"
|
||||
if [ "${regex:?}" = 'true' ]; then
|
||||
grep -vf "${blocklistFile:?}.pat" \
|
||||
-- "${blocklistFile:?}" > "${blocklistFile:?}.aux" \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue