In my program, I would like to first get the user input, and insert a \\ before each / so I write this, but it doesn\'t work.
\\
/
echo
You can also use Parameter-Expansion to replace sub-strings in variable. For example:
website="https://stackoverflow.com/a/58899829/658497" echo "${website//\//\\/}"
https:\/\/stackoverflow.com\/a\/58899829\/658497