Get the path
| Gabriel |
When you’re scripting (whether in Stata or anything else) you need to tell the script where to look for things by giving it a directory path. As previously mentioned, I think it’s a good idea to treat the path as what Stata calls a “macro” and most other languages call a “variable.” That way you can define the path at the beginning of the script and if you later decide to change the target path you can change the one macro/variable rather than combing through the script looking for each instance.
Of course, this assumes that you know what the path is, which can be hard to remember if it’s a long path. There are a few ways to get it.
From within Stata, the local
`c(pwd)' holds the current path and this info is also displayed in the interactive mode interface (in the toolbar on a Mac, at the bottom of the main window on Windows).
TextWrangler has a “copy path” feature in “get info”.
From the Mac Terminal you can get the path in the clipboard with pwd | pbcopy
In Snow Leopard, you can also do it as a Finder service. Follow these instructions, except substitute this shell script:
sed -e 's/:/\//g' -e 's/\ /%20/g' -e 's,[^/]*$,,' | pbcopy