Weird. This is one of those mildly annoying problems that have to bug me several times before I focus the energy to track them down. Recently, every time I open a new Terminal window, Terminal has been changing the working directory to a folder deep in my Documents tree. I thought this was very strange and couldn’t find evidence in my login scripts that this should have happened.
It turns out the problem is that when you use AppleScript to execute commands via Terminal, the last command you perform via the “do script” AppleScript command can get “stuck” in Terminal’s ExecutionString preference, which is run whenever a Terminal window opens. (Fortunately for me, the command that got stuck was a simple cd command.) There is no interface in Terminal to view or edit ExecutionString, which makes the bug a bit tricky to track down. (Huzzah for Google, as usual.) To fix it, you need to either edit com.apple.Terminal.plist manually, or execute the following command in a Terminal window:
defaults write com.apple.terminal ExecutionString ’’
No comments yet: