revert shellcheck tip for send_message, sed is faster

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-05-31 11:55:08 +02:00
parent 6d1e7cc065
commit 46748ee4b8

View File

@ -5,7 +5,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ 0.96-dev2-6-gda98b09
#### $$VERSION$$ 0.96-dev2-7-g6d1e7cc
# source once magic, function named like file
eval "$(basename "${BASH_SOURCE[0]}")(){ :; }"
@ -189,8 +189,8 @@ send_message() {
[ -z "$2" ] && return
local text keyboard btext burl no_keyboard file lat long title address sent
text="$(sed <<< "${2}" 's/ mykeyboardend.*//;s/ *my[kfltab][a-z]\{2,13\}startshere.*//')$(sed <<< "${2}" -n '/mytextstartshere/ s/.*mytextstartshere//p')"
#text="$(sed <<< "${text}" 's/ *mynewlinestartshere */\r\n/g')"
text="${text//?([[:blank:]]|^)mynewlinestartshere?([[:blank:]]|$)/$'\n\r'}"
# shellcheck disable=SC2001
text="$(sed <<< "${text}" 's/ *mynewlinestartshere */\r\n/g')"
[ "$3" != "safe" ] && {
no_keyboard="$(sed <<< "${2}" '/mykeyboardendshere/!d;s/.*mykeyboardendshere.*/mykeyboardendshere/')"
keyboard="$(sed <<< "${2}" '/mykeyboardstartshere /!d;s/.*mykeyboardstartshere *//;s/ *my[nkfltab][a-z]\{2,13\}startshere.*//;s/ *mykeyboardendshere.*//')"