mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-01 18:19:55 +00:00
setup-ngxblocker: improve find_line() detection
* adds regex to ignore commented lines in vhost files
This commit is contained in:
parent
a4e9d4dcdc
commit
863bf14bab
1 changed files with 3 additions and 2 deletions
|
@ -186,8 +186,9 @@ find_line() {
|
|||
local file=$1 find_str=$2 first_last=$3
|
||||
|
||||
case "$first_last" in
|
||||
first) awk "/$find_str/{ print NR; exit }" $file;;
|
||||
last) awk "/$find_str/{ print NR }" $file | tail -n1;;
|
||||
# ignore file #comments
|
||||
first) grep -nE "^[ ]+$find_str" $file | head -n1 | awk -F: '{print $1}';;
|
||||
last) grep -nE "^[ ]+$find_str" $file | tail -n1 | awk -F: '{print $1}';;
|
||||
esac
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue