1

I use a .command file to start a basic shell script in the form:

#!/bin/bash
-- this simply starts Something at /usr/local/bin/Something
myLittleOneLineScript

To make it work I changed its permissions and made it executable.

The question is: I run the latest Mac OS X version and this script perfectly works. But: will it work in any previous OS X version?

2
  • 1
    What makes you worry that it doesn't? – nohillside Jan 26 '16 at 11:29
  • 2
    @patrix: the simple fact that I don't know if it does ;-) – user165602 Jan 26 '16 at 12:29
2

"Will it work" has two aspects here:

  • will executing the binary work?
  • is bash capable of running the script as such.

The example looks fairly basic as far as shell scripting is concerned. So yes, it should work with previous OSX versions of bash. It would (as long as Something is installed in /usr/local/bin) even work in quite old versions of the Bourne Shell (/bin/sh) on various Unix systems.

0

In most (if not all) default OS X installations the script won't work (OK the script itself works but the command Something doesn't). The folder /usr/local/bin simply doesn't exist.

The folder /usr/local and all subsequent folders are reserved or designated for/to third-party commands.

Here are just a few examples of command line tools installed there by third-party app providers:

  • MySQL Community Edition (Oracle)
  • VirtualBox (Oracle)
  • TextWrangler/BBEdit (links to a subsequent app folder)
  • NMap
  • homebrew
  • ....

To get the script running you have to install the command line executable .../Something residing in a subfolder of /usr/local first. The installed executable has to be compatible with the older system and all arguments/options in the script itself have to be compatible with the lower versioned (old) executable.

3
  • 1
    the question is not about the executable. That is: I'm sure the executable is where it must be when the shell executes it – user165602 Jan 26 '16 at 12:35
  • 1
    @IanBell The backward compatibility of the shell script may depend on the content of the script and the features of the lower versioned executable. – klanomath Jan 26 '16 at 12:44
  • 1
    Ok, perfect, but that is not a problem because the users download a dedicated version of the executable, so if they use 10.8, they install the executable required for 10.8, etc. – user165602 Jan 26 '16 at 12:49

You must log in to answer this question.