0

I'm trying to run a terminal command (specifically, launching a Java application from command line) using bash on OS X, and distributing this command to users. The script is fine and works flawlessly, however!

If I were to export this as .command or .sh, each user would have to open terminal and chmod +x it to run it. This is completely counterproductive for what I'm trying to do (a one-click solution to hosting a server for a game).

I need a way to launch this bash command without permissions changing on the part of the user, and it MUST show terminal output in real time. This means not logging output to a text file- needs to show up in a terminal window.

I've tried making an application with automator to launch a shell script, which worked fine as far as perms go but doesn't show output.

I tried making a more workflow style app with automator that opened Terminal and then input the text (both inputting it as raw text and inputting it as a shell script). Both of these open a Terminal window but still don't show output.

The only solution I've got, and it's kinda janky, is to set the perms myself, zip the file, and send it that way. While zipped, the file retains its permissions settings. This is still one step more than I want to have as this is something I'm trying to send to paying users who might not be tech savvy at all.

George Barron
  • 99
  • 2
  • 3
  • 10
  • Did you read my post? That only sets permissions locally (for me). I need to be able to ship this with my game to other users and NOT have them have to set perms. – George Barron Jul 02 '14 at 06:27
  • encapsulate it as rpm or tar.gz maybe... – anishsane Jul 02 '14 at 07:13
  • Why not create a .dmg package. Lots of ways to do that [here](http://stackoverflow.com/a/8685513/2413778) – John C Jul 02 '14 at 07:53
  • I'd just put it in a zip file if I wanted to go this route. This is something that's going to be packed in with the actual game files that we're distributing via Steam; having a disc image ship inside an app bundle would be incredibly counter-intuitive. Thanks anyways, though. – George Barron Jul 03 '14 at 01:03

1 Answers1

0

If your script does not have execution permission, then you (and your users) can always pass it as input argument to shell, just like:

$ bash myscript

This command will run the script myscript even if it has not execute permission. Replace bash with the name of shell you want to run your script, but most probably it is bash anyway.

  • 1
    The point, like I said in the OP, is for this to be a one click operation. If users are going to have to work with Terminal, I might as well just make them chmod the script I'm already giving them. – George Barron Jul 03 '14 at 01:00