I created the following "Run Shell Script" service in Automator under Mac OS X Lion 10.7.4:
export DISPLAY=:0 /usr/X11/bin/xterm -title "Kevin's Xterm" -sb -sl 500000 -geometry 150x25 &
and created a keyboard shortcut to it. If I invoke this service twice, once from Automator-->Run and once from my keyboard shortcut, I get two xterms which appear identical but behave differently. Specifically, the following command fails with "permission denied" in the keyboard shortcut xterm but succeeds in the Automator-->Run xterm:
bash> mkdir /usr/local/testdir
The "id" command produces identical output in both xterms.
It would seem that the Automator-->Run xterm is behaving correctly, as it agrees with the behavior of Terminal.
Is there a way to make services behave identically (and correctly) regardless of their method of invocation?