Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Alan Riley <ariley@stata.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: winexec on Stata for Linux |
Date | Thu, 18 Nov 2010 18:07:14 -0600 |
Ulrich Kohler (kohler@wzb.eu) 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 & or . shell xdg-open fo\ o.eps >& /dev/null & --Alan ariley@stata.com * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/