Compile sh* or bat* files on MAC

Discussion in 'Buying Tips and Advice' started by VecsKrakjis, Dec 25, 2005.

  1. VecsKrakjis macrumors newbie

    Dec 25, 2005
    need help with compiling sh* or bat* files on MAC, need advice which program i need to use to do that?

    It need to look something like this..
    So i need a software to compile something like this?

    javac -cp .;./../OUTPUT;./../OUTPUT/unrenamed.jar; ./../OUTPUT/sign/*.java ./../OUTPUT/*.java *.java
    javac -cp .;./../BotClasses;./../OUTPUT;./../OUTPUT/unrenamed.jar;./LIB/; *.java
    javac -cp ../LIB;.;./../BotClasses;./../OUTPUT;./../OUTPUT/unrenamed.jar; *.java
    java -noverify -Xmx500m -cp .;./OUTPUT;./OUTPUT/unrenamed.jar;./BotClasses;./LIB; Bot %1

  2. generik macrumors 601


    Aug 5, 2005

    What you do is
    chmod +x <>

  3. notjustjay macrumors 603


    Sep 19, 2003
    Canada, eh?
    Or more to the point, .sh files are shell scripts which don't need to be compiled into an executable file -- as a script they are simply interpreted, line by line, by the shell. A .bat file is a "batch" file which has roots in MS-DOS.

    generik's instructions show you how to change permissions to allow the .sh file to be executable, and then how to actually run the script (note that in Unix you need to explicitly specify that the file you want is in the current directory, by using the "./" prefix on your filename... although slightly inconvenient, and easily circumventable, it is good practice for system security).

    Hope that helps.
  4. rockstar macrumors newbie

    Jan 7, 2006
    sh and unix executable files

    I am running OSX. I need to execute a unix executable file and then run a shell script.
    I've copied the exec file "transform" and *.sh file into the directory in which I want to run it. Then from X11 I go to that directory and type ./transform but receive the error message:
    tcsh: ./transform: Exec format error. Binary file not executable.

    This file was created with a f90 compiler at work (unix) and then copied to my mac. do I need to recompile it? If so how do I do that on mac?

    Then I need to run a shell script from within the same directory. Do I need to type /bin/sh *.sh ??

    :eek: help needed, thanks.
  5. cubist macrumors 68020

    Jul 4, 2002
    Muncie, Indiana
    You cannot expect a binary executable file "transform" from your work system to work on the Mac. This is because they probably have different types of CPUs.

    If you were using Java .jar files, they would work.

    Also, I don't think the Mac comes with f90, it might come with f77, you could possibly transfer the Fortran source to the Mac and recompile it.
  6. csubear macrumors 6502a


    Aug 22, 2003

    You could use fink to install g77. I don't think there is a free f90 complier for OS X.
  7. rockstar macrumors newbie

    Jan 7, 2006
    fortran compiler for Mac

    Thank you for the helpful responses. Indeed I already had g77 and f77 but neither seem to compile the f90 file. Maybe this is obvious.

    My command statement and error response was as follows:

    [athena:~] rockhopp% g77 ~/Desktop/transfer.f90 -o ~/Desktop/transform
    /usr/bin/ld: /Users/rockhopper/Desktop/transfer.f90 bad magic number (not a Mach-O file)
    collect2: ld returned 1 exit status

    Should I be doiong something different here? Alternatively, on Fink, there exists a g95, will this work as a compiler for an f90 program?

  8. bousozoku Moderator emeritus

    Jun 25, 2002
    Gone but not forgotten.
    It would seem that you don't have a compiler that was compiled for Mac OS X. Other than scripts and other interpreted code, you can't just pull code from another system and run it.
  9. rockstar macrumors newbie

    Jan 7, 2006
    Mac fortran compiler

    Thank you for your response. It is my understanding that g77 and f77 and g95 are Fortran compilers for Mac. My question is: it is likely that g77/f77 won't compile an f90 file (is this correct?) because f90 is a more recent language, but will a g95 compile an f90 file?

Share This Page