'How to escape double quotes in below bash script that is being used to send messages on discord using webhook?
I'm using following script to send messages to discord using webhook:
#!/bin/bash
webhookurl="https://discord.com/..."
messagearray=($(curl -s -i https://www.google.com/ | awk 'NR==12'))
message=`echo ${messagearray[@]} | tr -cd "0-9A-Za-z .=_,:\"()-[]{}\\'/'"`;
curl -H "Content-Type: application/json" -d '{"content": "'"$message"'"}' "$webhookurl"
The output in terminal is: alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
But in discord it sends without double quotes like this: alt-svc: h3=:443; ma=2592000,h3-29=:443; ma=2592000,h3-Q050=:443; ma=2592000,h3-Q046=:443; ma=2592000,h3-Q043=:443; ma=2592000,quic=:443; ma=2592000; v=46,43
I've used \" to escape double quotes but this doesn't seems to be working. What's the possible solution?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
