Showing results for 
Search instead for 
Did you mean: 

dtksh gui newline character not working

Go to solution
Frequent Advisor

dtksh gui newline character not working



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.


Frequent Advisor

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"`


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