Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I run a bash script from Spotlight, a terminal window launches to execute it. The window closes when the script finishes but I'd like to prevent that window from appearing on my desktop at all.

The script has several variants (in the same script) and much like {e,f,}grep, uses the launch name, $0, to select its options. It appends some stuff to a file and opens an editor (emacs, though that's not relevant) on the file, so rhe only window I need for interaction is the editor.

Right now, the only overhead per variant is a hard link to the script. I'd rather not use Platypus or AppleScript apps to launch it/them as then I'd need a whole package per variant. I'd just like a way for the terminal to run without showing its window.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

It turned out that Spotlight doesn't index all of the hard links to a file - only one of them - so that approach fails anyway.

Symlinks don't get indexed at all, so scratch that one.

OS-X aliases get indexed but the launched instance of the target script gets started with the script's original name - it gets no information about which link launched it.

I've settled on using one bash script per variant that just launches the main script with appropriate arguments, running in the background:

$ mainscript <args> &

A terminal window running the helper script blinks on only long enough to launch the main script in the background. It's accomplishes what I need.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.