Operating System - HP-UX
1753331 Members
5354 Online
108792 Solutions
New Discussion юеВ

Re: dtksh gui newline character not working

 
SOLVED
Go to solution
user001
Frequent Advisor

dtksh gui newline character not working

Hello,

 

I'm making a little dtksh script to make a couple of task easier and i'm running into a problem adding newline \n into strings.

 

I'm using

XmCreateMessageDialog BLAH $TOPLEVEL BLAHs \

 dialogTitle:"Some title" \

 helpLabelString:"Help" \

 cancelLabelString:"Cancel" \

 messageString:"I'm a string \n Neat Ha"

 

This doesn't appear to be working, if i put a newline on the end it won't work either as in outside the ".

 

How does everybody else make newlines?

 

Any help would be great.

Cheers.

2 REPLIES 2
user001
Frequent Advisor
Solution

Re: dtksh gui newline character not working

Mystery solved.

i ended up create a string and then using echo to get it in there e.g.

msg1=`echo "I'm \n a test \n message"`

then
messageString="msg1"

this worked, i've been looking for something like this for days now...hope someone uses it one day.

you can probably bypass using a sep string and just plug it straight into the messageString resource value but haven't tried.
Bill Hassell
Honored Contributor

Re: dtksh gui newline character not working

\n is not the newline character, it is an escape sequence that echo (as a shell built in or external command), awk, printf (and others) understand and will convert the special code to an actual newline character. Note that the term escape sequence has a larger meaning that includes anything that triggers an alternate interpretation of the next set of characters. It might be the "\" character, the ESC character or even ASCII SO and SI characters. It's up to the underlying translation routines to interpret such codes (or not).



Bill Hassell, sysadmin