Under Mac OSX (Mountain Lion), I have a shell script "a":
#!/bin/bash
open -a Terminal b
which run another shell script "b" using Terminal:
echo `pwd`
Something interesting is that, no matter where my running scripts are located, the pwd
command in "b" always returns the home directory.
Questions:
- Why does this happen?
- How to set the running environment to be the working instead home directory (ie, return the working directory when arriving at
pwd
)