Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

therealmuffin

macrumors newbie
Original poster
Jun 5, 2008
22
0
Howdy,

I have an application (GMPC) that is started from terminal. I can create a shortcut to that program with "ln -s 'loc. program' name_shortcut". However, I would like to pass an argument to it (like --fullscreen). In addition I would like the terminal window not to remain open. I was wondering if one or both are possible.

Thanks in advance, Maarten
 
I'm not sure about the argument but you can close Terminal with the command "killall Terminal".
 
I'm not sure about the argument but you can close Terminal with the command "killall Terminal".

But that will kill any sub-processes of the terminal application as well. That would mean the application that was launched from the terminal...

What you are creating is not a "shortcut", though, but simply a symbolic link. It's just an alternate name for a file in the filesystem. It doesn't allow you to set command-line parameters, the working directory, or environment variables, as you can with desktop shortcuts. Indeed, a symbolic link has no knowledge of file content - it's unaware whether the file is an application or a data file.

Unfortunately, OSX (despite being the "superior" GUI) lacks this capability which both Windows and Linux have.

Best you can do is create an Applescript. See here for a discussion:

http://macosx.com/forums/howto-faqs...and-line-apps-scripts-finder-applescript.html

Looks like MacScriptGUI is the closest thing you'll find to a Windows/Linux desktop shortcut.
 
Last edited:
But that will kill any sub-processes of the terminal application as well. That would mean the application that was launched from the terminal...
I'm not familiar with that app. Does the app run in Terminal, or does it only get launched in Terminal? If the app has already been launched, it won't be affected if you quit Terminal. If you need Terminal to remain running, go to
Terminal > Preferences > Settings > Shell and select "When the shell exits: Close the window"
Then when you type "exit" in Terminal, it will close the window but leave Terminal running.
 
If the application in question is a faceless background application, and you simply want to start it with arguments, then quit the Terminal - this is actually easy to do.

Make a little plain text file with a .command extension (instead of .txt), and put this in it:
Code:
#!/bin/sh
/path/to/program argument1 argument2 &
killall Terminal

That ampersand at the end tells Terminal to run the application in the background, effectively detaching it from the shell session.
 
Thanks all for your input. That little shell script works like a charm.

Maarten

ps. GMPC runs in X11 and is a client musicplayer/controller for a music database (Music Player Daemon or MPD).
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.