fix shellcheck errors
Some checks are pending
continuous-integration/laminar-eldarion Build failed with exit code 123 after 4 seconds

This commit is contained in:
Starbeamrainbowlabs 2021-12-26 14:59:12 +00:00
parent d11506c302
commit 5f412703e5
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -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} != '' ]]