1

so I am fairly new to linux and trying to figure out its ins and outs, I noticed that installed software behave differently, in such way that for example on my OpenSUSE I have both softwares OpenFOAM and MATLAB... In my .bashrc aliases, Openfoam has following alias alias OF='source /..../bashrc' but matlab alias os as follows alias matlab='/opt/..../matlab' which means matlab has an execuatable and openfoam just a bash script to run it...

my question is, why is it two different ways of running the softwares?

P.S: I havent installed the software myself, they were already there.

Thanks!

2

Developers have different approach when it come to the run of specific software. Some of them prefer to read all the parameters from config file(s) like matlab. Other prefer to set some of the parameters in environment variables and command line like openFOAM.

For some software developers are forced to use shell scripts because some parameters can be set only on start time (like most of the java software - heap size, GC, etc). For other software developers want/need to change environment variables (like LANG, LD_LIBRARY_PATH, etc) w/o set it for entire environment/terminal so they use shell scripts also.

Both ways work (as you can see).

6
  • aha, and for those software who are installed with shell scripts will i use the same shell script to run the software again later, just like the case in Openfoam or java software? or will the shell script produce another file for me?
    – QUTADAH
    Sep 25 at 15:54
  • I have installed pycharm, which is also installed with a shell script but i couldnt find it in my software where i could search for using windows key, what decides if a software has a launcher or should i do that manually?
    – QUTADAH
    Sep 25 at 15:56
  • @QUTADAH, installation process have nothing to do with the way you run something. So you usually install the software with one script and run it with script (other), binary or via external binary (java jar file for example) Sep 25 at 16:24
  • And @QUTADAH, if you have another questions do not ask in the current. Just create new question: unix.stackexchange.com/questions/ask Sep 25 at 16:27
  • 1
    aha ok will do so thanks!
    – QUTADAH
    Sep 25 at 16:28
0

Not all language can be compiled and have executable. Again, sometime the executable is called from shell script which act as a wrapper to pass correct arguments to the executable. Atom editor is an example of such.

Linux can execute binaries provided they are of right architecture and interpret any interpreted/scripting language code, provided it has a interpreter to do so. The executables located in $PATH can be called from shell. For other executable, you need to mention the path of the executable. Morever, executables need to have execution bit set for the user/group.

5
  • I think that answers my question of why sometimes an executable and other times bash script. Do you mean to say that there must be an executable in the source directory of the openfoam even if its being run with the script file?
    – QUTADAH
    Sep 25 at 12:20
  • Mind that bash script is also a executable, anything with a executable bit is an executable. The terms are binary and bash script. One possiblity is the program itself is written in bash, example neofetch. Other possibility, as with OpenFOAM, is that it acts as wrapper and sets its own configuration, like MANPATH, PATH, LD_LIBRARY_PATH and environment cleanups. If you read the code you can see several mentions to bin/, which holds the binaries. Sep 25 at 12:42
  • what do you exactly mean by executable bit? the reference to the /bin binaries in the /bashrc bash script? I have looked in /bin and yes you are right the /bashrc points to all the binaries in that folder
    – QUTADAH
    Sep 25 at 13:01
  • In Unices, executable bit means the permission of a file to be executable. Try chmod -x on your matlab executable and try launching it. It won't launch because it lost its executable bit. Revert the change by chmod +x. Read more about Unix file permission. Sep 25 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.