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]
|
# configLine [searchPattern] [replaceLine] [filePath]
|
||||||
# Ref https://stackoverflow.com/a/54909102/1460422
|
# Ref https://stackoverflow.com/a/54909102/1460422
|
||||||
config_line() {
|
config_line() {
|
||||||
local OLD_LINE_PATTERN=$1; shift
|
local OLD_LINE_PATTERN NEW_LINE NEW FILE
|
||||||
local NEW_LINE=$1; shift
|
OLD_LINE_PATTERN="$1"; shift
|
||||||
local FILE=$1
|
NEW_LINE="$1"; shift
|
||||||
local NEW=$(echo "${NEW_LINE}" | sed 's/\//\\\//g')
|
FILE="$1"
|
||||||
|
NEW="$(echo "${NEW_LINE}" | sed 's/\//\\\//g')";
|
||||||
|
|
||||||
touch "${FILE}"
|
touch "${FILE}"
|
||||||
sed -i '/'"${OLD_LINE_PATTERN}"'/{s/.*/'"${NEW}"'/;h};${x;/./{x;q100};x}' "${FILE}"
|
sed -i '/'"${OLD_LINE_PATTERN}"'/{s/.*/'"${NEW}"'/;h};${x;/./{x;q100};x}' "${FILE}"
|
||||||
if [[ $? -ne 100 ]] && [[ ${NEW_LINE} != '' ]]
|
if [[ $? -ne 100 ]] && [[ ${NEW_LINE} != '' ]]
|
||||||
|
|
Loading…
Reference in a new issue