diff --git a/qsgen2 b/qsgen2 index e5ee8da..927ee17 100755 --- a/qsgen2 +++ b/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 ${QSGEN} ${VERSION}" 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() {