Newline for gxmessage ?

Using applications, configuring, problems
Post Reply
Message
Author
scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

Newline for gxmessage ?

#1 Post by scientist »

Is there a way for gxmessage to use newlines in displaying messages ?

ex.

First line

second line
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#2 Post by MochiMoppel »

Code: Select all

MSG="First line
second line"

gxmessage "$MSG"
or

Code: Select all

gxmessage $'First line\nSecond line'

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#3 Post by scientist »

Thanks Mochi. :-)
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

User avatar
miriam
Posts: 373
Joined: Wed 06 Dec 2006, 23:46
Location: Queensland, Australia
Contact:

#4 Post by miriam »

I just had a similar problem and found this works:

Code: Select all

echo -e "first line \nsecond line" | gxmessage -file -
It works because when gxmessage is sent text from a file it prints the newlines properly. Telling it to use "-" as the source file makes it get the text from the standard input. And echo -e tells echo to use escape commands, such as \n for newline, \t for tab, etc.
[color=blue]A life! Cool! Where can I download one of those from?[/color]

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#5 Post by greengeek »

Unless I am misunderstanding the question you can just type exactly what you want including using the enter key to step to a new line.

eg:

Code: Select all

#! /bin/bash

gxmessage "  This is the line 1 info

   This is the third line - leaving the second line blank.
Here is the fourth line - notice it is not spaced out from the margin"
Oh - i just realised how old the thread is.
:oops:
Attachments
gxmessage.jpg
(15.77 KiB) Downloaded 84 times

User avatar
miriam
Posts: 373
Joined: Wed 06 Dec 2006, 23:46
Location: Queensland, Australia
Contact:

#6 Post by miriam »

Huh... I'd been testing from the commandline. I never even tried that solution in a script. Seems really obvious, now. Amazing how easy it is to overlook the obvious. :D

Thanks GreenGeek.

(I'm really glad old threads remain active here.)
[color=blue]A life! Cool! Where can I download one of those from?[/color]

Post Reply