Newsroom Update

Beginning in May, a special Today at Apple series titled “Made for Business” will offer small business owners and entrepreneurs free opportunities to learn how Apple products and services can support their growth and success. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Terminal - make it exit after running a command

I am looking for a way to exit terminal after executing a command.

I have tried this sort of thing
Open Terminal.

File -> Save As...

Save as "My Command FIle"
Choose "Where". Desktop is easy to find. Move it later.....

Under "Execute this Command", put your command line in there.

example
ls -l >gj.out

ls -l >gj.out; exit

combinations of the above using different options under Terminal- Window Settings - Shell { Process, ..}
close on exit etc. have not worked for me.

I get the command to execute; however, it sits in terminal.

I need it to exit. ?

Mac Mini, Mac OS X (10.4.10), Terminal exit

Posted on Oct 11, 2007 9:18 AM

Reply
3 replies

Oct 12, 2007 4:01 PM in response to gary_johnson_53

killall will kill every instance of Terminal running on the machine, not just the one that this script is running in. You might want to try as a test script:

ps auxwwww | egrep $(echo $PPID)


which, hopefully will list the Terminal that the script is running in. Then you can use the PPID (Parent Process ID) as an argument to kill to kill only your instance of Terminal.

Roger

Terminal - make it exit after running a command

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.