Replace string to $HOME by sed

sed "s/HOME/$HOME/g" t
# sed: -e expression #1, char 9: unknown option to `s'

Why? The $HOME contains ‘/’, It is in conflict with separating character. So, change the separating character to ‘|’.

sed "s|HOME|$HOME|g" t
# Passed!

Over!

Leave a Reply

Your email address will not be published. Required fields are marked *