Closed glutanimate closed 8 years ago
That's a strange way to create a variable...
Pushing this variable with newlines works for me:
var="line1\nline2\nline3"
pushbullet push device note title "$var"
Those aren't actual newlines, though; They are escape sequences that are recognized as newlines under certain circumstances (e.g. echo -e
).
See for yourself:
var1="line1\nline2\nline3"
var2=$'line1\nline2\nline3'
echo "$var1"
echo "$var2"
echo -e "$var1"
More info on this here:
https://stackoverflow.com/questions/9139401/trying-to-embed-newline-in-a-variable-in-bash
A more compatible way to insert newlines would be to simply type them into the terminal:
var="a
b
c"
But this is harder to copy and paste correctly, so I went with the bashism above.
I've filed a pull-request with a few modifications to the script that have fixed this for me (#51). Newlines in the body of pushes should be handled fine now.
Ok, well if that fixes it for you, great. I've accepted the pull request.
Steps to reproduce:
Create a variable with newlines within:
Try to push it:
This will fail with the following message:
I first ran into this issue after updating to the latest commits that overhauled the push system. I hope someone can find a way to fix this as supporting newlines is quite important for longer passages of text.
Thanks a lot for reading this.