Open file using bash with unix executable

0

I have an application which loads using a bash script e.g

/Applications/My.app/Contents/MyExecutable

I can load this using bash like so

"/Applications/My.app/Contents/MyExecutable"

However, I would like to open a file with this executable (a file that was created with the executable and can be loaded)

Im wondering how to do this?

This doesnt seem to work:

"/Applications/My.app/Contents/MyExecutable" "/Users/MyUser/Desktop/MyFiletoload.xxx"

Is there any common way of doing this?

Ke.

Posted 2014-11-15T12:07:08.737

Reputation: 303

If the application has not been coded to accept a file to open in its run string, there is not a lot you can do. You will need the run string specification: many programs accept a file as the first non-option parameter; others use -f FileName; yet others use different parameters, depending on the type or purpose of the file; and some do not look at the run string at all, but rely on a dialogue to specify a file to open. If the application is reasonably well written, app --help should summarise the run string; if it's even better written, there will be a manual page man app. – AFH – 2014-11-15T12:30:12.023

Thanks for this. I think the problem is that this app used to allow loading of files, but it looks like they are blocked now. Very useful answer. Many thanks. – Ke. – 2014-11-15T17:44:49.180

Answers

0

As someone mentioned in a comment, it all depends on the application. It would need to be written to accept a file as an argument/parameter when running it. There are multiple ways to pass a file into an application, but it depends on how it is written.

Mike

Posted 2014-11-15T12:07:08.737

Reputation: 58