I am trying to allow triggers to send text to notify-send in Linux. I
have tried a couple of different trigger /defs that have sort of worked
but not cleanly.
This works until any apostrophe ' gets me the following errors:
sh:-c:line1:unexpectedEOFwhilelookingformatching`"'sh: -c: line 2: syntax error: unexpected end of filesh:-c:line1:unexpectedEOFwhilelookingformatching`"'
So, I tried to just replace every space, ', and " with escapes.
This works in that I get the notification, except tinyfugue will vomit
the below at me even though the command did infact invoke notify-send
and give me my notification properly.
sh:-c:line2:syntaxerror:unexpectedendoffilesh:-c:line1:unexpectedEOFwhilelookingformatching`"'sh: -c: line 2: syntax error: unexpected end of file
Does anyone have a macro that auto-escapes stuff for sh in a way that tf
actually likes? I'm getting annoyed trying to figure out how to make a
string in tf it can use with /sys without upsetting sh -c.
Yaro
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Instead of modifying the argument to protect against shell expansion,
you can avoid shell expansion by passing the argument via an environment
variable:
I am trying to allow triggers to send text to notify-send in Linux. I
have tried a couple of different trigger /defs that have sort of worked
but not cleanly.
This works until any apostrophe ' gets me the following errors:
sh:-c:line 1:unexpected EOF while looking for matching "'
sh:-c:line 2:syntax error:unexpected end of file
sh:-c:line 1:unexpected EOF while looking for matching"'
So, I tried to just replace every space, ', and " with escapes.
This works in that I get the notification, except tinyfugue will vomit
the below at me even though the command did infact invoke notify-send
and give me my notification properly.
sh:-c:line 2:syntax error:unexpected end of file
sh:-c:line 1:unexpected EOF while looking for matching `"'
sh:-c:line 2:syntax error:unexpected end of file
Does anyone have a macro that auto-escapes stuff for sh in a way that tf
actually likes? I'm getting annoyed trying to figure out how to make a
string in tf it can use with /sys without upsetting sh -c.
I am trying to allow triggers to send text to notify-send in Linux. I
have tried a couple of different trigger /defs that have sort of worked
but not cleanly.
My first /def was:
This works until any apostrophe ' gets me the following errors:
So, I tried to just replace every space, ', and " with escapes.
This works in that I get the notification, except tinyfugue will vomit
the below at me even though the command did infact invoke notify-send
and give me my notification properly.
Does anyone have a macro that auto-escapes stuff for sh in a way that tf
actually likes? I'm getting annoyed trying to figure out how to make a
string in tf it can use with /sys without upsetting sh -c.
Yaro
Instead of modifying the argument to protect against shell expansion,
you can avoid shell expansion by passing the argument via an environment
variable:
/def -mregexp -F -t"(. says, .)" notify_say = \
/setenv WORLD=$[world_info()]%; \
/setenv ARG=%P1%; \
/sys notify-send "$$WORLD" "$$ARG"
On 2021-06-06 2:04 PM, Yaro Kasear wrote:
--
Ken Keys
kkeys@ucsd.edu