choosing executable depending on distro


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting choosing executable depending on distro
# 1  
Old 05-23-2011
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.

-------------------
Code:
#!/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:

Code:
./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!

Last edited by pludi; 05-23-2011 at 10:30 AM..
# 2  
Old 05-23-2011
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.
This User Gave Thanks to pludi For This Post:
# 3  
Old 05-23-2011
very thanks for your answer. Not the script works fine!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Linux

Help choosing distro

Hi, I just ordered an Skylake NUC and will run Linux on it. My distro of choice has been Ubuntu but I am fed up with the release cycle and would like more of a rolling release. I would say I am an intermediate level Linux user. It's going to be a HTPC, I want to have the latest kernels... (0 Replies)
Discussion started by: rthorntn
0 Replies

2. Linux

Choosing a UNIX

i have a project in numerical calculus in c language what unix i get better for this? (7 Replies)
Discussion started by: gitac
7 Replies

3. Cybersecurity

Choosing the right distro, Locked down from within.

I'm looking to put a box at a client site which will be connected to the client's home router for internet. That box will have remote access software on it and will have untrustworthy contractors logging in and using the browser. So, I'm looking for a distro that would be LOCKED DOWN to the max... (1 Reply)
Discussion started by: artranc3
1 Replies

4. Slackware

Help for choosing Slackware

Dear Friends, If I use Slackware for learning whether it will make any confusion in administering/using Redhat and SuSE since I have checked slackware is more like BSD. Thank you. (4 Replies)
Discussion started by: Tlogine
4 Replies

5. Linux

Choosing the best distro.

Hi all Help me find the best distro for the following configurations: Intel pentium IV 1.6 Ghz 128 MB RAM :( 40 GB Hardisk with one very big partition more than 35 gb n another 2 gb partition. windows xp is already installed but has enough free space (26gb). Which linux will be... (0 Replies)
Discussion started by: bbala
0 Replies

6. UNIX for Dummies Questions & Answers

I need help choosing a linux.

There are soo many flavors of linux and i just cant choose/find the right linux for me... I am hopeing for a linux that is a Workhorse Can fit of a seires (or 1) disk(s) Lots of features (admin/mod features) A learning mode or a detailed tutorial Can work side by side with windows... (12 Replies)
Discussion started by: lithuaniaakid
12 Replies

7. UNIX for Dummies Questions & Answers

Choosing a version

I know that the rules say no school questions but I am in advanced topics and am going to go to college for programming and I want to find a easy first OS to start me out, please help, thanks (3 Replies)
Discussion started by: KoKo
3 Replies

8. UNIX for Dummies Questions & Answers

Need help in choosing Unix Platform.

I'm a completely noob to Unix. I have previously managed quite well Windows OS's but never Unix. -My question is quite simple: I've been investigating what's the easiest and most complex Unix OS. However, it seems there are quite a couple of OS's from which to choose, like: -Darwin ... (3 Replies)
Discussion started by: justanoob
3 Replies

9. Programming

Choosing Java or C++

Listen, if you know a bit of programming in C and need to program unix-type operating systems the next transitive stage is for sure C++. However, have in mind that Java is like learning C but 99% object-oriented(o.o.) and with no pointers or memory-management tricks. It would be good for you to see... (5 Replies)
Discussion started by: SolidSnake
5 Replies
Login or Register to Ask a Question