mirror of
https://github.com/linuxboot/heads.git
synced 2025-01-18 10:46:44 +00:00
Handle the case where grep operates on an empty file
There are cases when grepping for an option in the config file where grep will not find it, which is fine in this case, but without adjusting the exit code in that case it can make an entire script bail out.
This commit is contained in:
parent
dd3f650b81
commit
1e9491f98d
@ -228,7 +228,7 @@ replace_config() {
|
||||
awk "gsub(\"^${CONFIG_OPTION}=.*\",\"${CONFIG_OPTION}=\\\"${NEW_SETTING}\\\"\")" /tmp/config >> ${CONFIG_FILE}.tmp
|
||||
|
||||
# then copy any remaining settings from the existing config file, minus the option you changed
|
||||
grep -v "^export ${CONFIG_OPTION}=" ${CONFIG_FILE} | grep -v "^${CONFIG_OPTION}=" >> ${CONFIG_FILE}.tmp
|
||||
grep -v "^export ${CONFIG_OPTION}=" ${CONFIG_FILE} | grep -v "^${CONFIG_OPTION}=" >> ${CONFIG_FILE}.tmp || true
|
||||
|
||||
mv ${CONFIG_FILE}.tmp ${CONFIG_FILE}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user