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

BlindSoul

macrumors 6502
Original poster
May 30, 2010
466
0
Israel
Hello,

How can I run a bash file when opening an application?
( When someone is opening the application the .bash file will run too ).

Also, I was wondering if this code is can be correct:
prism --app application.ini --override ../Resources/webapp/
override.ini --webapp ../Resources/webapp


Thank you very much.
 

thundersteele

macrumors 68030
Oct 19, 2011
2,984
9
Switzerland
Right now I can think of two ways of doing it:

1) Call the script in the applicationDidFinishLaunching() method using NSTask

2) Use automator to bundle the execution of the shell script together with the application

I'm not sure if calling a bash script during program start is good programming style for OSX apps. It might be a security issue too.
 

BlindSoul

macrumors 6502
Original poster
May 30, 2010
466
0
Israel
Well, I need it much simpler. It's a very simple application of mine.
What I need it to do exactly:
Is to make an app file, which when executed, runs another app located inside its directory with some additional arguments
I should achieve that using a bash file, but if you have a better solution...?
 
Last edited:

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,423
A sea of green
What language is your app written in?

This seems obvious to me, but have you tried making the executable referred to by Info.plist simply be a bash shell script? Then you can run whatever you want, because it's just a shell script.

If a direct shell script doesn't work, try Platypus. Also see a past post on Platypus.
 

thundersteele

macrumors 68030
Oct 19, 2011
2,984
9
Switzerland
Well, I need it much simpler. It's a very simple application of mine.
What I need it to do exactly:
Is to make an app file, which when executed, runs another app located inside its directory with some additional arguments
I should achieve that using a bash file, but if you have a better solution...?

I still don't get it.

What is an app file? Do you want something that when you double click it executes a shell command?

Of course you can do whatever you want with a bash file, but you would still have to launch it using a terminal...
 

ibennetch

macrumors member
Aug 9, 2008
39
0
Hello,

How can I run a bash file when opening an application?
( When someone is opening the application the .bash file will run too ).

What I need it to do exactly:
Is to make an app file, which when executed, runs another app located inside its directory with some additional arguments
I should achieve that using a bash file, but if you have a better solution...?

These sound like two different requirements to me. Some of the other folks have asked good questions which might help clear this up, but do you have an application (say Pages) that exists and you need to run a bash script when a user opens that application, or do you want to make an application/script that in turn calls another program?

If it's the second -- which is what your latest post states, a few lines of bash should do just fine. Then you'd execute the script file instead of the application from the Finder. Either I misunderstood or my system differs from thundersteele's; I can just double-click a bash script to have it execute; I don't need to go to terminal (although it does open a new Terminal instance which can be unsightly).
 

thundersteele

macrumors 68030
Oct 19, 2011
2,984
9
Switzerland
Double clicking a shell script also works on my machine. I don't like the terminal popping up when I start an application - for me, it's either a shell script, then I launch it from a shell, or an application icon, then I don't want to see the shell ;)
 

ibennetch

macrumors member
Aug 9, 2008
39
0
Double clicking a shell script also works on my machine. I don't like the terminal popping up when I start an application - for me, it's either a shell script, then I launch it from a shell, or an application icon, then I don't want to see the shell ;)

Ah, sorry I just misunderstood then. But yes, I completely agree about how unsightly it is to have another shell script window running underneath the application I want.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.