fix shellcheck errors
Some checks are pending
continuous-integration/laminar-eldarion Build failed with exit code 123 after 4 seconds
Some checks are pending
continuous-integration/laminar-eldarion Build failed with exit code 123 after 4 seconds
This commit is contained in:
parent
d11506c302
commit
5f412703e5
1 changed files with 6 additions and 4 deletions
|
@ -4,10 +4,12 @@
|
|||
# configLine [searchPattern] [replaceLine] [filePath]
|
||||
# Ref https://stackoverflow.com/a/54909102/1460422
|
||||
config_line() {
|
||||
local OLD_LINE_PATTERN=$1; shift
|
||||
local NEW_LINE=$1; shift
|
||||
local FILE=$1
|
||||
local NEW=$(echo "${NEW_LINE}" | sed 's/\//\\\//g')
|
||||
local OLD_LINE_PATTERN NEW_LINE NEW FILE
|
||||
OLD_LINE_PATTERN="$1"; shift
|
||||
NEW_LINE="$1"; shift
|
||||
FILE="$1"
|
||||
NEW="$(echo "${NEW_LINE}" | sed 's/\//\\\//g')";
|
||||
|
||||
touch "${FILE}"
|
||||
sed -i '/'"${OLD_LINE_PATTERN}"'/{s/.*/'"${NEW}"'/;h};${x;/./{x;q100};x}' "${FILE}"
|
||||
if [[ $? -ne 100 ]] && [[ ${NEW_LINE} != '' ]]
|
||||
|
|
Loading…
Reference in a new issue