Sourcing

Good evening..

I'm installing some software on a Solaris 10 machine, and the instructions mentioned 'Sourcing" a script. I've never heard of that, looked around an it appears to be something that is done at startup maybe? Is that right? Anyway, The instruction is below- and I have no idea what do with it. Could someone please help? man source gave me some ideas but I don't think it worked. I tried sh torVars.sh and exec torVars.sh-

Before you run Tornado, you need to set several environment variables. You can
do so most easily by changing directory to installDir/host/sun4-solaris2/bin,
and then sourcing torVars.csh or torVars.sh—depending on the shell you use. If
you use another shell, these scripts contain all the information you need to set the
appropriate variables.

Thanks

Have you tried source toVars.sh or . /full/path/toVars.sh ?

Sourcing will define variables, functions from source file, and make it available to new processe(es) executed from your shell after the file has been sourced.

This is commonly used software installation, to maintain a definition of paths and functions requried for sofware install and/or running of e.g JAVA_HOME, TMP_DIR etc.

Hope that helps
Regards
Peasant

2 Likes

These extra "before you start" instructions are wide spread in Unix applications, and are the main reason why Unix is "user unfriendly".

With some effort (e. g. by creating a start wrapper) one can turn such an application into a "simply run me" one.

2 Likes

OK Thanks..

I navigated to the directory and used ./torVars.sh
and just saw a quick terminal pop up.

Trying the launch command launch & I see 1817 launch: Command not foundThen pressing enter I see [1] Exit 1 launch

But the application doesn't launch. I also tried changing to csh and ran the csh version of that script. Any ideas?

Not without seeing your script..
Most likely command launch is not in your $PATH.
Try adding set -x and see what debugging info you get

You really need to source the script with one of the syntax given by Peasant (for the second syntax, don't forget the space between the dot and the path to the script) and not simply execute the script.

In case of simple execution, the script is executed in a new process (called subshell) and all variable declarations are defined only in this subshell. Then these variables are not available for other scripts.