I want to send the XML (HTML) content I get from a file to a substitution function so I can fix the wrong HTML entities (and overwrite the file). But I am not able to do it
This is the function based another answer I found
function htmlEscape () {
local s=$1
s=${1//&/&}
s=${s//</<}
s=${s//>/>}
s=${s//'"'/"}
echo $s
}
I tried
cat $TEMPFILEPATH | htmlEscape > $TEMPFILEPATH
tee $TEMPFILEPATH <<< htmlEscape "$(cat $TEMPFILEPATH)"
But those do not work. I am really really really new with bash scripts. Does anyone can help me?