Refactor _f_last_updated
This commit is contained in:
parent
48b2f30ea7
commit
0ff85c7128
15
qsgen2
15
qsgen2
@ -430,23 +430,26 @@ function _f_last_updated() {
|
||||
local debug=true
|
||||
fi
|
||||
|
||||
local file_path="${1}"
|
||||
# local file_path="${1}"
|
||||
local upd_msg="Last updated ${today} by <a href=\"https://blog.kekepower.com/qsgen2.html\">${QSGEN} ${VERSION}</a>"
|
||||
|
||||
if ${debug}; then
|
||||
_msg debug "_f_last_updated: Setting date and version in footer of file ${file_path}"
|
||||
_msg debug "_f_last_updated: Setting date and version in footer of file ${1}"
|
||||
_msg debug "_f_last_updated: ${upd_msg}"
|
||||
fi
|
||||
|
||||
# Read the file content into a variable
|
||||
local content="$(<${file_path})"
|
||||
local content="$(<${1})"
|
||||
|
||||
# Perform the replacement
|
||||
content="${content//#updated/${upd_msg}}"
|
||||
|
||||
sed -i '' -e "s|#updated|${upd_msg}|" "${file_path}"
|
||||
# Write the updated content back to the file
|
||||
#print -r -- "$content" >| "${file_path}"
|
||||
if [[ -f "${1}" ]]; then
|
||||
sed -i -e "s|#updated|${upd_msg}|" "${1}"
|
||||
else
|
||||
_msg debug "_f_last_updated: File '${1}' not found."
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function _file_to_lower() {
|
||||
|
Loading…
Reference in New Issue
Block a user