choosing executable depending on distro

Hi,
I have an application in 2 different directories, one is for OpenSuSE and the other for CentOS.

I wrote a script which chooses the right executable for the distribution. But it does not work.

-------------------

#!/bin/bash

if [ -r /etc/SuSE-release ]
then

( DN="/home/apps/applicationXY/Version3.1" )
else

( DN="/home/apps/applicationXY/Version3.1_centos55" )
fi

export APPL1_HELPDIR=$DN/resource/Help_Document
export LD_LIBRARY_PATH=$DN/lib:$LD_LIBRARY_PATH


$DN/applicationexe $*

-------------------
If I execute the script the output is:

./scriptname: line 19: /applicationexe: No such file or directory

Does the variable from the if -clauses not work with the part after the if-clauses? Or what is my

error?

Very thanks for your help!

The if-clause probably works. However, you're setting the variables inside a sub-shell (everything in braces is executed in a sub-shell), which keeps them out of reach of the main shell. Remove the braces, and it should work fine.

1 Like

very thanks for your answer. Not the script works fine!