Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Close terminal with .command file?

0 views
Skip to first unread message

Scott

unread,
Jun 21, 2007, 8:58:00 PM6/21/07
to
I'm fairly new to OS X and the mac platform in general. I just got all
my Perl scripts working (that were previous geared towards windows
platform), but I was only able to launch from the command line... I
didn't like this.

Anyhow, I was able to figure out that if I changed the extension
to .command, then I could double click from the desktop... or
wherever.

The .command works perfect, it launches a terminal and executes the
script (this is necessary because some of the scripts require input).
My new pet peeve is that the terminal remains open! I tired putting a
simple exit command, no dice... the terminal just says [logout]
process completed. Some quick searches as not given me much insight.

So, how can I go about closing the terminal after the script is
complete..? Or I should say, what do I need to add to the end of my
script to close the terminal?

Thanks in advance,

Scott

Message has been deleted

Scott

unread,
Jun 22, 2007, 9:35:04 AM6/22/07
to
I found a solution... I put this in there:

kill -3 $(ps wax | grep "[T]erminal.app" | awk '{print $1}')

Its a bit brute, but it works.

SA


Michael Ash

unread,
Jun 22, 2007, 10:08:08 AM6/22/07
to

If you plan on distributing these things, could you tell me where they can
be found and what they're called so I can make sure I never, ever end up
using them by mistake?

--
Michael Ash
Rogue Amoeba Software

Tony Walton

unread,
Jun 22, 2007, 10:22:00 AM6/22/07
to

Thus trashing any other terminals the user happens to have open,
completely unconnected with your app.

I'd call that buggy.

--
Tony

Scott

unread,
Jun 22, 2007, 10:41:14 AM6/22/07
to
I agree it's nasty... but how do you go about closing that specific
terminal. Or even better yet, how can I tell it to not even show the
terminal? When I run Perl's on windows, you just the the command
window blink as it runs, then it closes... how can I emulate this...
gracefully?

Patrick Machielse

unread,
Jun 22, 2007, 12:31:42 PM6/22/07
to
Scott <saub...@gmail.com> wrote:

You might be able to use AppleScript (through the osascript command) and
'tell window 0 of application 'Terminal' to close' (or someting similar
that actually works).

patrick

Ben Artin

unread,
Jun 22, 2007, 6:02:07 PM6/22/07
to
In article <1182523274....@u2g2000hsc.googlegroups.com>,
Scott <saub...@gmail.com> wrote:

> I agree it's nasty... but how do you go about closing that specific terminal.

Instead of using a .command file, use a .term file. The way you make one of
those is so open a new window in Terminal, set its settings the way you want
them, then use File > Save. All the window settings get saved, and you get to
specify which command is to be run when the file is loaded.

hth

Ben

--
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>

I changed my name: <http://periodic-kingdom.org/People/NameChange.php>

Bob Harris

unread,
Jun 22, 2007, 6:50:44 PM6/22/07
to

-- AppleScript wrapper to execute UNIX shell scripts
-- with a drag and drop interface.
-- Found basic script at http://MacOSXHints.com
-- cmdenv is a program I originally wrote back in
-- 1985 to help me see what a fork/exec'ed program
-- was seeing. I find it highly useful.
-- Bob Harris 4-Jun-2005

on open filelist
repeat with i in filelist
-- do shell script "my_command " & quoted form of POSIX path of i
do shell script "yourScriptHere >/dev/null " & quoted form of
POSIX path of i
end repeat
end open

-- NOTE: the do shell line may be line warpped.
-- It is suppose be one line ending in "... POSIX path of i"
-- so if it has been lined wrapped put it back together again

-- Use the Applications -> AppleScript -> Script Editor
-- to create an executable AppleScript from the above.

Bob Harris

0 new messages