[TxMt] global (project-)command questions [... how to make a command to restart apache and reload a test page in the browser]

Allan Odgaard throw-away-1 at macromates.com
Wed Nov 1 19:15:21 UTC 2006


On 1. Nov 2006, at 17:40, Dirk van Oosterbosch, IR labs wrote:

> [...] if I try to make it into a oneliner the variable replacement  
> fails:
>   osascript -e 'tell app "Safari" to open location  
> "$IR_LABSITE_TESTURL"'

In single quotes, the shell does not expand variables. It does it for  
double quotes, so try instead:

     osascript -e "tell app \"Safari\" to open location  
\"$IR_LABSITE_TESTURL\""


> 2. Can a command in one bundle access the support folder of a  
> different bundle?

Not without a hardcoded path, so basically no.

> Or can a command from a different bundle be triggered from the  
> current?
> I'd like to use the apachectlUsingKeychain.sh shell script that  
> comes with the Apache bundle, but is there a way to access that  
> bundle's support folder? Or do I have to copy the script to the  
> support folder of my own bundle?

I’d recommend copying the script.

> 3. What does the '-ne'  in  'if [[ $(ps -xp $PPID|wc -l) -ne 2 ]];  
> then' do?

You can do ‘man test’ to see what the options do. -ne is “not equal”.

So it runs ps to ask for processors with the process ID being that of  
our parent ($PPID) which would be TextMate’s. Then it counts the  
number of matches (wc -l) and sees if that is two.

I guess something simpler would be:

     if ps -cp $PPID | grep -sq TextMate; then …





More information about the textmate mailing list