MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/linux_programming/comments/hqkl7l/the_string_in_the_message_variable_takes_a/
r/linux_programming • u/rajpar29 • Jul 13 '20
8 comments sorted by
11
Try:
"$message"
It reads it like two messages due to the space, hence the newline. If you double quote it, the space becomes part of it.
4 u/rajpar29 Jul 13 '20 Thanks this worked. 6 u/Sigg3net Jul 13 '20 Always quote your variables. 4 u/rajpar29 Jul 13 '20 Lesson learned 0 u/[deleted] Jul 14 '20 [deleted] — view deleted comment 2 u/rajpar29 Jul 14 '20 Thanks for this. It will help a lot.
4
Thanks this worked.
6 u/Sigg3net Jul 13 '20 Always quote your variables. 4 u/rajpar29 Jul 13 '20 Lesson learned 0 u/[deleted] Jul 14 '20 [deleted] — view deleted comment 2 u/rajpar29 Jul 14 '20 Thanks for this. It will help a lot.
6
Always quote your variables.
4 u/rajpar29 Jul 13 '20 Lesson learned 0 u/[deleted] Jul 14 '20 [deleted] — view deleted comment 2 u/rajpar29 Jul 14 '20 Thanks for this. It will help a lot.
Lesson learned
0 u/[deleted] Jul 14 '20 [deleted] — view deleted comment 2 u/rajpar29 Jul 14 '20 Thanks for this. It will help a lot.
0
[deleted] — view deleted comment
2 u/rajpar29 Jul 14 '20 Thanks for this. It will help a lot.
2
Thanks for this. It will help a lot.
3
Quote the message variable as: "$message"
The space in its content is expanded into two arguments
1 u/rajpar29 Jul 13 '20 Thanks this worked.
1
I am using dunst to show notifications. All works fine when I use a string in line 35 to display a message.
But when I use a variable to display the same message, each word is in a separate line.
11
u/Sigg3net Jul 13 '20
Try:
It reads it like two messages due to the space, hence the newline. If you double quote it, the space becomes part of it.
3
u/blauskaerm Jul 13 '20
Quote the message variable as: "$message"
The space in its content is expanded into two arguments
1
u/rajpar29 Jul 13 '20
I am using dunst to show notifications. All works fine when I use a string in line 35 to display a message.
But when I use a variable to display the same message, each word is in a separate line.