Created
May 8, 2020 11:05
-
-
Save shellscriptx/42bfce0155817ac446c1d5ec83995905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Função de escape (markdown) | |
esc(){ | |
local str=$1 | |
# Caracteres: *_`][ | |
str=${str//\*/\\*} | |
str=${str//_/\\_} | |
str=${str//\`/\\\`} | |
str=${str//\[/\\[} | |
str=${str//\]/\\]} | |
echo "$str" | |
} | |
# Considere tratar separadamente a expressão cujo os | |
# caracteres precisam ser escapados. | |
exp="[Resultado]: 6*5=$((6*5))" | |
# Mensagem | |
ShellBot.sendMessage --chat_id xxxxx --text "*A soma dos valores é:\n$(esc "$exp")*" --parse_mode markdown |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment