Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: re:shell


From   "Neil Shephard" <[email protected]>
To   [email protected]
Subject   Re: st: re:shell
Date   Mon, 09 May 2005 11:21:58 +0100

> Correct, I was not trying do-file code, in which (interactive) case /*
> means naught. But this DOES work in do-file code;
> 
> -- start do file --
> cd /applications/stata/ado/base
> local c = c(alpha)
> 
> foreach w of local c {
>  local arg "`w'/*.ado"
>  di "`arg'"
>  ls `arg'
>      }
> -- end do file --
> 
> Quoting the expression containing the forward slash protects it from
> being interpreted as a comment, and it will work in a shell command.
> 

I can confirm that quoting protects the forward slash from being interpreted as a 
comment, but for some reason Stata8.2 (born 10 Jan 2005) under GNU/Linux then fails 
to interpret the directory path correclty....

. do /home/heil/tmp/test/test

. local slash "/"

. forval x = 1/1{
  2.   !ls /home/neil/tmp/test`slash'*.*
  3.   !ls ~/tmp/test`slash'*.*
  4.   !ls "/home/neil/tmp/test/*.*"
  5.   !ls "~/tmp/test/*.*"
  6. }

/home/neil/tmp/test/test.do
/home/neil/tmp/test/test.do~

/home/neil/tmp/test/test.do
/home/neil/tmp/test/test.do~

ls: /home/neil/tmp/test/*.*: No such file or directory

ls: ~/tmp/test/*.*: No such file or directory

. 
end of do-file

...which I find a bit strange?

Neil

Neil Shephard
Genetics Statistician
ARC Epidemiology Unit, University of Manchester
[email protected]
[email protected]

"If your result needs a statistician then you should design a better experiment" - 
Ernest Rutherford

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index