"\e" is the shorthand for typing the escape character, you will probably
want to escape the backslash like so: `\\`. It looks like you may be trying
to create a command string, but you've used string delimiters (") instead
of cmd delimiters (`). Julia always uses the entire literal string (include
embedded newlines) until the closing " character). Because some characters
(like a newline) cannot be directly printed, Julia shows it as \n when
representing it in "" quotes to display the variable. Similarly, it prints
a literal " as \" so that you can tell that the " is part of the string and
not indicating the termination of the string.


On Wed, Aug 26, 2015 at 7:00 PM J Luis <[email protected]> wrote:

> I need to build a command as a string to pass to an external program
> (GMT), so I started to build it this way
>
>     julia> ps   = "V:\example_23.ps";
>
>     julia> name="Rome";
>
>     julia> "pscoast -Rg -JH90/9i -Glightgreen -Sblue -A1000 -Dc -Bg30
>             -B+t\"Distances from " * name * " to the World\" -K -Wthinnest
> > " * ps
>
>     "pscoast -Rg -JH90/9i -Glightgreen -Sblue -A1000 -Dc -Bg30\n
> -B+t\"Distances from Rome to the World\" -K -Wthinnest > V:\example_23.ps"
>
>
> Two things here. Shouldn't the \" show up as quote char in the string
> (that is , without the '\')?
>
> But the second is worst. Why is it adding that '\n' (note it after the
> '-Bg30')?
> Because of this spurious '\n' the call to the GMT program fails. It does
> work if I create the cmd string in a single line but I should not be forced
> to do so
>
> Thanks
>
> Joaquim
>
>
>

Reply via email to