Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: winexec on Stata for Linux

From   Alan Riley <>
Subject   Re: st: winexec on Stata for Linux
Date   Thu, 18 Nov 2010 18:07:14 -0600

Ulrich Kohler ( is trying to launch another
program from within Stata for Linux using the -winexec- command.
He is trying to pass a filename containing a space as an argument
to that program and is receiving an error:

> . sysuse auto
> . sc weight mpg
> . graph export foo.eps, replace
> ... 
> . copy "foo.eps"  "fo o.eps"
> -winexec- seem to be not able to open the file. I tried:
> . winexec xdg-open fo o.eps
> . winexec xdg-open "fo o.eps"
> . winexec xdg-open fo\ o.eps
> . winexec xdg-open 'fo o.eps'
> ...
> but non of these produced any output at all (i.e. no error messages, no
> messages from the shell, nor any window popping up; just the Stata
> prompt.).
> ...

What Uli would like to do is escape the space in the filename.  His
guess to type

    . winexec xdg-open fo\ o.eps

was a good one, as \ is the character in Unix/Linux to escape a space
or other special character.

However, -winexec- does not currently allow spaces to be escaped.  It
should, and this will be fixed in a future update.

In the meantime, Uli can work around this by using a standard
shell command, directing its output to /dev/null, and running it
in the background.  In this way the command will return control
immediately to Stata.

Depending on whether Uli is using bash, tcsh, or some other shell in
Linux, one of the following two commands should work from within Stata:

   . shell xdg-open fo\ o.eps > /dev/null 2>&1 &


   . shell xdg-open fo\ o.eps >& /dev/null &

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index